开发者

How to Use PDB file to debug the application?

I've created a simple winform project,开发者_如何学C added ClassLibrary with a single method that triggers IndexOutOfRangeException.

The form call this library and displays unhanded exception.

I build everything in Release mode with pdb files

When I run the Exe I get the error reporting window with error info.

What now? how do I use PDB file with this error report to debug the program?


The easiest way to use the PDB file is to let Visual Studio do the heavy lifting - either launch your program with Visual Studio's "Debug" command (F5 by default), or run the program and use the "Attach to Process" item in Visual Studio's Debug menu. If the PDB is located in the same directory as the executable, Visual Studio should detect and use it without any further intervention on your part.


In VS 2013 (I don't know about VS 2008), an alternative to running the program and using "Attach to Process" in the Debug Menu, as mentioned in the accepted answer, is to add before the line you want to start debugging in your class:

Debugger.Launch();

Also add this line at the top of your class:

using System.Diagnostics;

Then recompile your code. This can be useful if you want to attach to whichever process uses this class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜