urker
urker

Reputation: 123

How to Use PDB file to debug the application?

I've created a simple winform project, 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?

Upvotes: 4

Views: 21606

Answers (2)

grumpy_data_engineer
grumpy_data_engineer

Reputation: 442

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.

Upvotes: 1

Ben
Ben

Reputation: 6059

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.

Upvotes: 4

Related Questions