Full call stack not available when C# exception is thrown



This is probably a generic C# question but when an exception is thrown in my application I do not have access to the full call stack, only the call stack from the Xenko Runtime .DLLs.

The exception is thrown from my code, in a function that originates from the GameBase.Tick(), but unfortunately I cannot see the remaining draw calls that leads to my own code…


That’s an interesting question in my opinion since I wondered as well before. (I was only seeing up to the Game.Start() thing)

Would be interesting to hear about it.


I think in this situation your code actually hasn’t been reached yet, so it’s not part of the call stack.


Thanks Sherlock but the exception is thrown from my own code, the fact that it’s not in the call stack in my “original post” is actually the problem.

I will repeat it again just for you… the exception is thrown from my own code (that I wrote myself), however once the exception is thrown the callstack does stop at some point instead of bubbling up to my own code.


What are the debug settings currently active in your Visual Studio (including exception filters)? Also check the other threads when breaking, although if an exception occurs (assuming the correct settings are set) you should break in the corresponding thread.


@matmuze I did a quick test with a fresh installation of Visual Studio Community 2017.

By default the exception settings are set to handle almost no exceptions (including the exception type you create yourself). In that setting, the code indeed only breaks outside user code and you don’t see the full stack trace.

To change this behavior, be sure to at least check “<All Common Language Runtime Exceptions not in this list>” under “Common Language Runtime Exceptions” in the “Exception Settings” window/tab. You might want to enable other type of exceptions as well.

For more on the subject see https://docs.microsoft.com/en-us/visualstudio/debugger/managing-exceptions-with-the-debugger


More on…C# Exception Handling