The game starts and runs without any problem when I built it without the .net native toolchain.
But if I enable this feature (which MS forces me to do) I receive following exception:
Exception thrown: 'System.AggregateException' in System.Private.Threading.dll
Additional information: AggregateException_ctor_DefaultMessage
If there is a handler for this exception, the program may be safely continued.
And this occurs at SpriteBatch = new SpriteBatch()
protected override void Initialize()
{
...
SpriteBatch = new SpriteBatch(Graphics.GraphicsDevice); // <--- HERE
Graphics.IsFullScreen = true;
Graphics.ApplyChanges();
...
base.Initialize();
}
I used to get those all the time when developing for Win8.1 Store. You can ignore them and continue.
NETFX use exceptions extensively for flow control. SpriteBatch doesnât use anything related to threads. Thatâs just an exception thrown internally from the system and then re-thrown as AggregateException from the game-loop thread. Itâs annoying but nothing to worry about. You can uncheck the âBreak when this exception type is thrownâ to avoid seeing this all the time.
Yes, but that exception gets thrown everytime. Catching does not work somehow. It does not enter the catch clause, even if the exception scope is set to âExceptionâ.
But anyway, it works even with that exception. Just wanted to share here my findings
Logging does not qualify as âhandlingâ an error. I strongly oppose this practice. You must catch exceptions only when you know how to recover from that specific error. Otherwise you should left it unhandled and let the program abort.
Of course it doesnât, because the source of the exception is coming from another thread, from an async function inside the OS. Be sure that the OS already handled this error and as the message says âthe program may be safely continueâ. if it doesnât you are not in position to handle & recover from it anyway, in that case the program will just fail and terminate.
VS2012 used to pause on those errors all the time when developing for Win8.0. Nowdays VS2015 is better at ignoring those unrelated exceptions but I suppose they still pass through when you switch to Net.Native.
EDIT: âŚor maybe you will still get those when you enable âmanaged & native debuggingâ. I donât know.