7

I am debugging an exception in my ASP.NET Application (C# , visual studio). this exception is thrown at the top level of another thread (this is not the problem, i changed that behaviour to not throw a top level exception).

I was just wondering about this: This Exception kills the whole worker process. But, when i am debugging, the debugger stops at that exception and it seems to be 'thrown' repeatedly (whenever i press continue, it will stop at that same line again). It does not execute the line before again, so it really stops at that special exception.

Is this just because of a special behaviour of the debugger? Or is that exception also thrown repeatedly when i am not debugging it?

Thanks in advance!

Dennis
  • 14,210
  • 2
  • 34
  • 54
  • 2
    I get the same behaviour if I just throw an unhandled exception in e.g. a console app. I don't think the exception is being thrown repeatedly - it's just that for some reason the debugger keeps you at that line rather than letting the thread die. – Rawling May 16 '12 at 10:38
  • Thanks for your comment! Yes, I have also seen that behaviour in console apps before; but never in ASP.NET Apps. Maybe this is, because in the main thread in web apps there is some kind of 'global catch' that leads to the yellow screen. And now i'm seeing that same behaviour because this is in another thread? – Dennis May 16 '12 at 10:41

1 Answers1

10

Is this just because of a special behaviour of the debugger? Or is that exception also thrown repeatedly when i am not debugging it?

The Visual Studio debugger doesn't let the thread die due to the unhandled exception. The exception isn't being rethrown, the debugger doesn't let the line continue since it will crash the process. If the debugger wasn't attached, then IIS would give you the yellow screen of death and the event log would have been populated with the information contained within.

This is the same behavior for all applications, web or client side while debugging.

Oblivion2000
  • 616
  • 4
  • 9