article describes how to debug a Microsoft Visual Basic .NET or Microsoft Visual Basic 2005 application.
Microsoft Visual Studio .NET or Microsoft Visual Studio 2005 debugger can attach to a program that is running
in a process outside the Visual Studio environment. The debugger can attach to
a process that is not responding. The debugger displays disassembly view and
pauses the running process. Based on the availability of the Program DataBase
(.pdb) file and source code, the debugger displays the source code with
The following list outlines the recommended hardware, software,
network infrastructure, and service packs that you must have:
- Microsoft Windows 2000 or Microsoft Windows XP
- Microsoft Visual Studio .NET or Microsoft Visual Studio 2005
Use the Debug Class and the Trace Class
You can use the Debug
class and the Trace
class to provide information about the performance of an
application. You can also use these classes to identify problem areas of an
application. You can do this during application development or after production
deployment. These classes are available in Microsoft .NET Framework. You can
use the Trace
class to instrument release builds. Instrumentation allows you to
monitor the health of your application that is running in real-life settings.
Using the Trace
class helps you isolate and fix problems without disturbing a
running system. You can use the Debug
class to print debugging information, and to check your logic
with assertions. You can make your code more robust, without impacting the
performance and code size of your shipping product.
For additional information
about using the Trace class and the Debug class in Visual Basic .NET, click the
following article number to view the article in the Microsoft Knowledge Base:
TO: Trace and Debug in Visual Basic .NET
Application that Does Not Respond
To debug a Visual Basic .NET application, follow these steps:
- Open Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
- On the Tools menu, click Debug
- In the Processes dialog box, click to
select the program that you want to attach from the Available
Processes list. If the program you want to debug is running on another
computer, you must first click to select the remote computer.
more information about selecting a remote computer, visit the following MSDN
Selecting a Remote Machine
- Click Attach.
- In the Attach to Process dialog box, make
sure the appropriate program type is selected in Choose the program
types that you want to debug. For example, to debug a Visual Basic
.NET or Visual Basic 2005 application, click to select Common Language
- Click OK.
Processes dialog box is displayed.
- In the When debugging is stopped list,
click to select Detach from this process when you want the
program to detach from the process without quitting. Click to select
Terminate this process when you want the program to
- Click to select the process in the Debug
Processes list box, and then click
Debugger stops in disassembly view, and the
program is paused. If the .pdb file is available in the same directory as the
executable, debugger loads the source code.
- To view the source code, right-click
Disassembly, and then click Go to Source Code
to switch to the Code window. Insert a break point where you want
- On the Debug menu, click
Continue or press the F5 key to continue the process.
The debugger automatically stops when it reaches the
- On the Debug menu, click Stop
Debugging or press the SHIFT+F5 keyboard shortcut to stop
Use a Memory Dump File
For your application that is not responding, you can generate a
memory dump file. In Windows debugger, you can use the memory dump file to
debug the cause of your application not responding.
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
HOW TO: Use ADPlus to Troubleshoot "Hangs" and "Crashes"
- If you are debugging a program running on remote computer,
install Mdm.exe on the computer. If Mdm.exe is not installed on the remote
computer, install Mdm.exe, and then start the process before
- If the application is running in Release mode, the Debug class output is ignored.
For more information,
visit the following Microsoft Web site:
Production Debugging for .NET
Article ID: 318357 - Last Review: December 6, 2006 - Revision: 3.5
- Microsoft Visual Basic 2005
- Microsoft Visual Basic .NET 2003 Standard Edition
- Microsoft Visual Basic .NET 2002 Standard Edition
|kbvs2005swept kbvs2005applies kbnamespace kbmanaged kbdynamic kbdev kbdesigner kbdebug kbhowtomaster KB318357|