
Debug a Failing Application #42
Chapter 5, Debugging
|
167
HACK
Windows Forms JIT Debugging
When you first try JIT debugging with a Windows Forms application, it
probably won’t work. By default, Windows Forms will display a dialog that
gives you the ability to see the details of the exception, continue, or quit, but
not the ability to attach a debugger to the process. To enable JIT debugging
with Windows Forms, you will need to add a configuration setting either to
the app.config of your application or, if you want to enable JIT debugging
for all Windows Forms applications, to the machine.config. To enable JIT
debugging, you need to add the following element inside the
<config-
uration>
element:
<system.windows.forms jitDebugging="true" />
This will enable JIT debugging either for the application (if you added it to
the app.config) or for all Windows Forms applications on your machine (if
you added it to the machine.config).
If your application does not already have an app.config, you
will need to create one by right-clicking on the project,
selecting Add New Item, and then selecting the application
configuration file from the list of files.
If you want to modify the machine.config file to enable JIT debugging for all
Windows Forms applications, the file can be found in the following direc-
tory:
%SystemRoot%\Microsoft.NET\Framework\v1.1.4322\machine.config
The machine.config file actually already has this ...