views:

211

answers:

3

Trying to debug a controllers action method, and when I attach to process the debug icon goes hollow and says the 'current breakpoint will not be hit'

But I am doing a response.write at that point and when the page renders it does output the test text.

So that section is indeed being executed, why does debug mode not work?

+6  A: 

Your source code may be different than the version of the corresponding process that you are attaching to. Your other process may also be built in release mode, i.e., there is no debug info.

Ed Swangren
darn, it was in release hehe.
mrblah
+4  A: 

There are a few reasons why you may see this message:

  • You are attached to the wrong process
  • You are attached to the right process but the AppDomain hasn't loaded the assembly yet
  • You are attached to the right process but you have forgotten to build so the source code and the PDB file are out of sync
Andrew Hare
+1 for the more thorough answer.
Andrew Song
+1  A: 

I've noticed this happen when using reflection and dynamically loading .dll projects. If the code isn't specifically reference (i.e. you are using interface animal but dynamically loading implementations of animal such as cat/dog) it will say it won't hit the breakpoint, but actually does.

mrnye