CoreException "Loading exception"

Sep 15, 2011 at 4:00 AM

Hi,

When i try to clear a scene and load another gamestate like :

Application.SunBurn.Clear();

GameState.Application.LoadGameState(new MyMenuGameState("My application", GameState.Application), new PleaseWaitGameState("Please Wait", GameState.Application));

the framework trow always an CoreException "Loading exception" fron the load method of the gamestate classes.

Why this exception was throwed ? And how i can debug this because i think it's the thread that will throw the exception.

For information the _loadingTask.Exceptions contains a NullReferenceException.

Thank you in advance.

Coordinator
Sep 15, 2011 at 8:30 AM

Hi rc183,

The Loading exception is raised when using the asynchronous loading system and one of the content paths you are trying to load isn't valid. I just created a new issue to provide you with a better exception description so that it raises exactly what the problem is. Until then, double check the code that is being executed in your LoadContent methods for the objects implementing IContentHost that you added to your GameState.

Regards

Sep 19, 2011 at 1:03 PM

Hi,

Thank you for your answer. The issue is : "Content repository named 'Content' already exists." because i have cleared the Scene interface with :

Application.SunBurn.Clear();

and when i load my new scene with my gamestate (witch use MyLevelLayer witch extend SunburnLayer) :

GameState.Application.LoadGameState(new MyLevelGameState("My application", GameState.Application, level), new PleaseWaitGameState("Please Wait", GameState.Application));

The exception was throwed by the load method of the SunburnLayer.

I think the issue is that the this load method try to load the contentRepository but don't check if this contentRepository already exists. It appears that it should be loaded only once at the beginning of the game.

There is a solution to avoid this issue ?

Thank you in advance.

Coordinator
Sep 20, 2011 at 9:38 AM

That's definitivelly an issue I need to look closer at.

Until I get rid of the issue, you may want to override the LoadContent method and implement your own ContentRepository and Scene loading.

Regards