Disable WPF exception for debugging

Is there a way to turn off WPF very annoying exception handling when debugging?

An example would be a window in which there is a text field, the text field is bound to a property, the receiver of this property throws an exception that cannot be handled by the presentation environment (for example, throw a new StackOverflowException ()).

What I have to see is

get { throw new StackOverflowException(); // < Exception happened here } 

Instead, I see ...

  No Source Available Call Stack Location: PresentationFramework.dll!MS.Internal.Data.PropertyPathWorker.RawValue(int k) + 0x64 bytes 

Due to the WPF exception exception, this exception is also sometimes caught and dispatched, and then it is either unloaded or hidden deep inside MS.Internals and it is impossible to return to the actual exception site. This leads to the fact that we see a giant column PresentationFramework.dll, PresentationCore.dll and WindowsBase.dll, but not user code except App.Main ().

This happens during binding, events triggered during creation, and in other completely random situations without a rhyme or reason (an exception during a button click sometimes does this to me). Now yes, I can look at the stack trace inside the exception, but this stack trace is also pretty pointless because I cannot go back to this frame to see which variables are in the throw.

+6
source share
1 answer

Typically, when debugging, I use debug → exceptions and select a throw for Runtime Common Language exceptions. Then it will stop at the point at which the exception is thrown.

Visual Studio 2010 Exceptions dialog with common language runtime exceptions ticked

+3
source

Source: https://habr.com/ru/post/900546/


All Articles