Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio error: "The debugger cannot unwind to this frame." on any exceptions

I used to be able to edit and continue when an exception occurred in my Visual Studio 2015 C# (WPF if relevant) projects. I often get simple things like null reference exceptions, and I could just quickly fix the issue and continue.

However, recently I've been constantly getting the following warning message:

enter image description here

"The debugger cannot unwind to this frame."

It notes that unwinding is nor possible in the following:

  1. Debugging was started via Just-In-Time debugging. - This isn't the case, I'm debugging by running the "Start debugging" from Visual Studio.
  2. An unwind is in progress - Not that I'm aware of, unless for some reason it's always in progress!
  3. A System.StackOverflowException or System.Threading.TreadAbortException - This happens on all exceptions, including simple ones like Null Reference

My googling comes up with a few articles saying they've implemented this feature in 2006, other than that, only about 3 results come back!

It seems to be project specific. In a clean new project:

Object o = null;
String s = o.ToString();

Throws an exception, and lets me edit and continue the line before. In my existing project I cannot unwind and it throws up the dialog.

Edit: Tried it with a different computer and Visual Studio install and still have the issue.

It seems to be an issue with Caliburn Micro.

If I have a button on my user interface linked to an event in the code behind with the above code, I can rewind and debug. However, If I use cal.message.attach and put the code in the referenced ViewModel's method, then I cannot unwind. But I'm not sure.

like image 472
Joe Avatar asked Jun 02 '16 09:06

Joe


1 Answers

You can try and test these solutions one by one.

  1. Unwinding exceptions is unreliable in optimized code. Debug | Options - Check 'Enable Just My Code'
  2. Debug | Options - Check 'Use Managed Compatibility Mode'
  3. Debug | Options - Uncheck 'Enable property evaluation and other implicit function calls'. If that doesn't work, also:
  4. Debug | Options - Check 'Use the legacy C# and VB expression evaluators'
  5. Debug | Windows | Exception Settings - Expand the 'Common Language Runtime Exceptions' dropdown. Make sure your exception is checked.
like image 111
Melih Yilman Avatar answered Nov 08 '22 14:11

Melih Yilman