Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS 2010 debugger not loading symbols when attaching to NUnit

(I just posted this in the NUnit discussion group on groups.google.com)

Under VS 2008, I would run my tests under NUnit, and, if I needed to debug, I would attach the VS2008 debugger to the running Nunit process (Debug -> Attach to Process), and set any breakpoints on code I wanted to examine. When I hit the Run buttion in NUnit, it would hit the breakpoint. (BTW, if it matters, this was running NUnit 2.5.2).

I just upgraded to NUnit 2.5.4 and VS 2010. When I set a breakpoint, then attach to NUnit, I get a little warning symbol on the breakpoint dot, and hovering over it gives the tooltip "Breakpoint will not be hit. No symbols are currently loaded". Going to the Debug -> Windows -> Modules window shows a whole bunch of Windows and NUnit modules loaded, with the Symbol Status of "Skipped loading symbols", and then 1 module with a funny name that changes each time (r1euhmh5 right now), and Symbol Status of "No symbols loaded". (There is no trace of a module with a name remotely like my DLL under test).

Right clicking the funny filename (assuming that to be some mapping from my DLL under test), and clicking Load Symbols From -> Symbol Path, and navigating to the bin\debug folder, then clicking the pdb file of my DLL under test, I get the message "A matching symbol was not found in this folder". (The top of the Open dialog box has a line that says "Original location: r1euhmh5.pdb")

So what's changed? And how do I go about debugging/breakpointing under VS 2010/NUnit 2.5.4 (Or is it possible I screwed something up when I decided to go through my VS2010 options and set some of them to more advanced levels than I knew what I was doing?)

I appreciate any help.

like image 939
Dave Hanna Avatar asked Apr 19 '10 18:04

Dave Hanna


People also ask

How do I fix No symbols have been loaded for this document?

"No Symbols have been loaded for this document"Go to the Modules window (Debug > Windows > Modules) and check whether your module is loaded. If your module is loaded, check the Symbol Status column to see whether symbols have been loaded.

How do I load debug symbols in Visual Studio?

In Visual Studio, open Tools > Options > Debugging > Symbols (or Debug > Options > Symbols).


2 Answers

I'm not sure I understand exactly why, but the answer is to attach the debugger to nunit-agent.exe instead of nunit.exe. See Charlie Poole's response here

like image 132
Dave Hanna Avatar answered Nov 08 '22 10:11

Dave Hanna


There's information on this blog post about how to tell NUnit to use the correct .Net framework in the nunit.exe configuration file.

The benefit to fixing this in the configuration file is that it allows you to set up your unit test project so that you can launch NUnit as an external command when you select Debug -> Start New Instance.

like image 30
Dave Bacher Avatar answered Nov 08 '22 11:11

Dave Bacher