Sign in to follow this  
LandWarrior

Throwing Exception in a component gives Invalid Call?

Recommended Posts

LandWarrior    100
Hello,

I have done research on this Invalid-Call-problem quite long, but somehow the answers seem to confuse me since there are really astoundingly many ways of what can cause this specific exception.

First my problem:
1. I have a Game class that does the Update/Draw-Stuff, which is similiar to the SlimdX-Sample Game class from the Feb2010 SDK.
2. I have a MenuSystem, which - at initialize - loads in the menu and layout files
3. When loading a layout, some entries are allowed to throw a dedicated exception (CLayoutException) which is immediately caught by the Menu System (so the exception won't go higher in the hierarchy).
--> When this exception is caught, what follows is an immediate STOP, caused by the call made to "SlimDX.[...].Device.BeginScene()".
But, if the exception under (3.) is NOT being caused, everything runs just fine.

I mean of course, in general it is good to NOT have exceptions, but I don't want to put a try-catch with an empty catch-block around everything, that is bad design in my opinion :/
Especially when the layout file from above is modifyable by the user and the user can also enter wrong, unexpected and flawed information which is read by the component.

I'm really into this problem for 3 hours straight and I can't come up with a cure...
What you may need to know is, that everything is on the same Thread, so there is no concurring access at this stage (game initialization phase).

Any ideas? I'd be thankful for each bit of help! :)

Best regards,
chris

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this