Greg
Greg

Reputation: 2179

Visual studio won't debug into referenced DLL (from same solution)

I have a Visual studio 2008 solution, with 2 projects. A DLL, A, and a Web application, B.

B has a project reference to A, and A.dll and A.pdb are being copied to B's bin/ directory.

Everything is set to compile in debug mode.

I can run the cassini webserver and debug web application B fine, but when I come to call a method in A.dll, pressing F11 to step into it does not step into it, it steps over it. I want to step into it.

Any ideas why I might not be able to step into the source code of A?

Edit: Additional Info

I do not have 'just my code' checked.

I can set a breakpoint in the DLL, and it shows as a red circle (not a hollow one), but it is never hit.

Hmmm... I just altered the code in the DLL which is being called to start with

throw new Exception("Hello");

And I'm not getting an exception. That's pretty suspicious...

Upvotes: 12

Views: 12216

Answers (5)

Phil Haselden
Phil Haselden

Reputation: 3006

Check whether the DLL has a line like the following in its AssemblyInfo.cs. You may have to temporarily comment out that line in order to step into the DLL while debugging.

[assembly: AssemblyKeyFile("..\\..\\something.snk")]

Upvotes: 0

jKlaus
jKlaus

Reputation: 382

To those saying to disable "Just My Code", he specifically states the two projects are in the same solution so that would not apply. The only logical conclusion is user error/misunderstanding.

Upvotes: 3

Greg
Greg

Reputation: 2179

Aha!

The method in B I was calling returned IEnumerator<SomeObject>. It was an iterator block with yield keywords and so was not being executed (as I hadn't written the consumer yet).

sigh

Upvotes: 4

Matt Brunell
Matt Brunell

Reputation: 10389

You probably have the 'Just my code' option set in your debugging options. Turn that off and you can step into code from a dll.

Upvotes: 2

JaredPar
JaredPar

Reputation: 754743

The most likely problem is that Visual Studio doesn't consider the DLL to be part of "your code". The way to work around this is to disable the "Just My Code" debugging feature.

  • Tools -> Options -> Debugging
  • Uncheck "Enable Just My Code"

After doing this you should be able to step into your code without incident.

Upvotes: 20

Related Questions