I'm having problems with debugging an application that calls out to another AppDomain, because if an exception occurs in whatever the other AppDomain is doing, the exception bubbles up and causes Visual Studio 2010 to break no matter what.
I've properly wrapped the method call that throws in a try/catch
, and the exception is properly caught when I'm running the application (an ASP.NET MVC application) normally, but when debugging w3wp.exe
in Visual Studio 2010, it always breaks on the method call that throws and there's no way I can get past the exception even though it should be caught.
I've tried to decorate the outer method in which the try/catch
and throwing method call is done with [DebuggerStepThrough]
but that has absolutely no effect. Doing "Continue (F5)", "Step over (F10)" or "Step Out (F11)" does nothing either; Visual Studio just pauses for a bit and then breaks again at the exact same spot with the exact same exception. Once Visual Studio has stopped at the point in which the exception occurs, there seems to be absolutely no way to move on.
What I'm doing exactly is calling assembly.GetExportedTypes()
which may throw if an exported type is referencing an assembly that can't be found (a circumstance I want to ignore). The exception thrown is:
FileNotFoundException crossed a native/managed boundary
I'm catching FileNotFoundException
properly and as I've said, that works when running the application, but not while debugging. How can I make the debugger understand that I give a rats ass if assembly.GetExportedTypes()
throws?
I thought I had this wrapped up by unchecking the option in Visual Studio 2010 called "Break when exceptions cross AppDomain or managed/native boundaries (Managed only)" (under Debugging > General), but the problem popped up again just now. I've sprinkled [DebuggerStepThrough]
, [DebuggerStepperBoundary]
and [DebuggerNonUserCodeAttribute]
on the method in question withuot any effect.
There's an option in Visual Studio 2010 called "Break when exceptions cross AppDomain or managed/native boundaries (Managed only)" (under Debugging > General) that, when unchecked, sometimes helps. When it doesn't I need to quit Visual Studio 2010, delete all temporary files, and then try again. Not a very elegant solution, so if anyone have any better ideas, please provide them.
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