Beta Information
This article discusses a Beta release of a Microsoft
product. The information in this article is provided as-is and is subject to
change without notice.
No formal product support is available from
Microsoft for this Beta product. For information about how to obtain support
for a Beta release, see the documentation that is included with the Beta
product files, or check the Web location from which you downloaded the release.
SUMMARY
This step-by-step
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
disassembly view.
back to the
topRequirements
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
back to the topUse 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:
313417
HOW
TO: Trace and Debug in Visual Basic .NET
back to the
topDebug an
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
Processes.
- 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.
For
more information about selecting a remote computer, visit the following MSDN
Web site:
Selecting a Remote Machine
http://msdn.microsoft.com/library/en-us/vsdebug/html/vctskselectingremotemachine.asp - 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
Runtime.
- Click OK.
The
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
quit.
- Click to select the process in the Debug
Processes list box, and then click
Break.
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
it.
- On the Debug menu, click
Continue or press the F5 key to continue the process.
The debugger automatically stops when it reaches the
breakpoint. - On the Debug menu, click Stop
Debugging or press the SHIFT+F5 keyboard shortcut to stop
debugging.
back to the topUse 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:
286350
HOW TO: Use ADPlus to Troubleshoot "Hangs" and "Crashes"
back to the
topTroubleshoot
- 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
debugging.
- If the application is running in Release mode, the Debug class output is ignored.
back to the top