Export (0) Print
Expand All

How to: Enable Just-In-Time Debugging for Windows Forms

This topic applies to:

Visual Studio Edition

Visual Basic

C#

C++

J#

Express

No

No

No

No

Standard

Yes

Yes

Yes

Yes

Pro/Team

Yes

Yes

Yes

Yes

You can enable Just-In-Time debugging to launch the Visual Studio debugger automatically when a program, running outside Visual Studio, encounters a fatal error. Just-In-Time debugging is enabled in the Options dialog box.

Windows Forms applications require the following additional steps, because, by default, Windows Forms applications have a top-level exception handler that allows the program to continue to run if it can recover.

Procedure

To enable Just-In-Time debugging of a Windows Form

  1. Set the jitDebugging value in the machine.config or application.exe.config file, located in the system.windows.forms section to true. For example:

    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>
    
  2. In addition, Windows Forms created by using C++ must have the DebuggableAttribute set in a .config file or within their code. If you compile with /Zi and without /Og, the compiler sets this attribute for you. If you want to debug a non-optimized release build, however, you must set this yourself by adding the following line to your application's AssemblyInfo.cpp file:

    [assembly:System::Diagnostics::DebuggableAttribute(true, true)]; 
    

    For more information, see DebuggableAttribute.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft