3

I am having a nuisance problem with a C# app. To simplify the scenario, I have a main .exe project which references another C# library as a direct DLL dependency. This DLL throws exceptions in a particular place, and the debugger is breaking on those. However, the exception is handled and not re-thrown. My exceptions dialog in VS is checked to only have the debugger break on User-Unhandled exceptions of this type (InvalidOperationException), yet it is still breaking.

However if I link the same library as a project reference (rather than to the compiled DLL) the debugger no longer breaks on this exception.

As well, if I run the .exe program directly (outside the debugger) I see no evidence that this exception is not being handled as I expect. No errors, and my logging indicates the expected control flow.

The related code has been mostly unchanged for some time, but I have refactored my solutions and projects; I was previously using only project references, so perhaps never spotted this issue until I went to DLL references.

Can anyone suggest anything else I might look at as to why the debugger is breaking on this handled exception?

RJ Lohan
  • 6,497
  • 3
  • 34
  • 54
  • Very strange. What happens if you remove the dependant dll's pdb? – Ikaso May 20 '14 at 05:15
  • No change; in fact the PDBs are not present in this case. (But I did try the same scenario with PDBs included) – RJ Lohan May 20 '14 at 05:16
  • Take a look on [this](http://stackoverflow.com/questions/10201622/how-can-i-prevent-swallowed-exceptions-in-3rd-party-libraries-from-triggering-th?rq=1) SO question. – Ikaso May 20 '14 at 05:18

1 Answers1

1

I did some more googling and fiddling, and I have settled on the idea that it seems the 'Enable Just My Code' is what is causing the debugger to break

This link gave me some clear insights into how this option affects the Debugger: http://www.jaylee.org/post/2010/07/05/VS2010-On-the-Impacts-of-Debugging-with-Just-My-Code.aspx

RJ Lohan
  • 6,497
  • 3
  • 34
  • 54