Debugging

  • Thread starter Thread starter Mike W
  • Start date Start date
M

Mike W

When I run my project in Debug mode and I get an unhandled exception, I get
a window that says "An unhandled exception has occurred in your
application..." with Continue and Quit buttons. I would like for Visual
Studio to break on the line of code that caused the exception.

I have

<system.windows.forms jitDebugging="true" />

in my machine.config file and there is no application.config file.

Under the Debug -> Exception menu in Visual Studio, I have "If the exception
is not handled" set to "Break into the debugger" for all 4 exception types
listed.
 
Mike,

You can set by right clicking a breakpoint or just the word Stop, what is a
little bit dangerous when you forget that.

I hope I understood you well and this helps?

Cor
 
That's true, if I knew ahead of time that a line of code would be causing an
exception, then I could put a breakpoint on that line, but I would probably
change the code so that it doesn't cause an exception.

Anyway, I want Visual Studio to break on ANY line of code that causes an
exception. I have seen it do this before, so I know it is possible. Can
anyone help with this??
 
Mike,

It is not impossible that the error apears in a part where is
<System.Diagnostics.DebuggerStepThrough()>

What is by instance in the designer part.

As well it can become because of an endless loop, than you don't know were
it is. This will happen in recursief methods by instance.

However just some guesses.

Cor
 
Mike,
Under the Debug -> Exception menu in Visual Studio, I have "If the
exception is not handled" set to "Break into the debugger" for all 4
exception types listed.
Did you try changing the "Debug - Exception - When the exception is thrown"
to "Break into the debugger" also?

As the dialog that you show (in your later post) is the one that Windows
Forms shows when you do not handle the Application.ThreadException event. In
other words Windows Forms is handling the exception for you, ergo it is not
a unhandled exception per se...

Hope this helps
Jay
 
Back
Top