Is there an way to disable WPF's very annoying exception wrapping when debugging?
An example would be a window that owns a text box, the text box is bound to a property, the getter on that property throws an exception that can't be handled by the presentation framework (throw new StackOverflowException() for example).
What I'm should be seeing is
get
{
throw new StackOverflowException(); // < Exception happened here
}
Instead what I'm seeing is...
No Source Available
Call Stack Location:
PresentationFramework.dll!MS.Internal.Data.PropertyPathWorker.RawValue(int k) + 0x64 bytes
Because of WPF's exception wrapping this exception is also sometimes caught and dispatched then is either rethrown or hidden deep within MS.Internals and impossible to return to the actual site of exception. This results in us seeing a gigantic callstack of PresentationFramework.dll, PresentationCore.dll, and WindowsBase.dll but NO user code except for App.Main().
This occurs during binding, events called during creation, and other completely random situations without rhyme or reason (exception during button click sometimes does this to me). Now yes I can look at stack trace inside of the exception but that stack trace is also pretty much meaningless because I cannot return to that frame to see what the variables are that at the time of throw.
Generally when debugging I'd use the debug -> exceptions and select thrown for Common Language Runtime Exceptions. This will then halt at the point that the exception is thrown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With