To debug a .NET Framework application, the compiler and runtime environment must be configured to enable a debugger to attach to the application and to produce both symbols and line maps, if possible, for the application and its corresponding Microsoft Intermediate Language (MSIL). Once a managed application is debugged, it can be profiled to boost performance. Profiling evaluates and describes the lines of source code that generate the most frequently executed code, and how much time it takes to execute them.
The .NET Framework applications are easily debugged using Visual Studio .NET, which handles many of the configuration details. If Visual Studio .NET is not installed, you can examine and improve the performance of .NET Framework applications in several alternative ways using the following:
- Systems.Diagnostics classes.
- Runtime Debugger (Cordbg.exe), which is a command-line debugger.
- Microsoft Common Language Runtime Debugger (DbgCLR.exe), which is a Windows debugger.
The .NET Framework namespace System.Diagnostics includes the Trace and Debug classes for tracing execution flow, and the Process, EventLog, and PerformanceCounter classes for profiling code. The Cordbg.exe command-line debugger can be used to debug managed code from the command-line interpreter. DbgCLR.exe is a debugger with the familiar Windows interface for debugging managed code. It is located in the Microsoft.NET/FrameworkSDK/GuiDebug folder.
In This Section
- Enabling JIT-attach Debugging
- Shows how to configure the registry to JIT-attach a debug engine to a .NET Framework application.
- Making an Image Easier to Debug
- Shows how to turn JIT tracking on and optimization off to make an assembly easier to debug.
- Enabling Profiling
- Shows how to set environment variables to tie a .NET Framework application to a profiler.
- Tracing and Instrumenting Applications in Visual Basic and Visual C#
- Describes how to monitor the execution of your application while it is running, and how to instrument it to display how well it is performing or whether something has gone wrong.
- ASP.NET Optimization
- Describes how to profile and optimize ASP.NET applications.