Devolus
Devolus

Reputation: 22094

Unable to break execution. This process is not currently executing the type of code

I have a strange problem using Visual Studio 2010.

I'm running a DLL, which is loaded from IIS in the process w3p.exe from Microsoft. When I start the remote debugger on another machine and attach my local machin there, everything is fine and I can debug. The problem is when I run it locally. I know that the DLL is loaded (because of logfiles) and I can attach the debugger to the process. But when I try to Break all I get an error saying

Unable to break execution. This process is not currently executing the type of code you selected to debug.

The project settings are definitely pointing to the project that just compiled the running DLL, so I don't really understand this error message.

Also when I set breakpoints nothing happens. The debugger is attached though, because when I stop IIS then I get an error message telling me that the debugger needs to be stopped first.

I'm using an intentional application error fopen(NULL, NULL) which will allow me to attach a debugger in the debug build. But this is rather annyoing, because I have to clear the call stack manually before I can actually start debugging. Using __debugbreak() doesn't help, so I have to use this clumsy workaround.

So can anybody tell me why this works remotely, but not locally?

Upvotes: 0

Views: 2059

Answers (1)

Devolus
Devolus

Reputation: 22094

So I finally found a solution to my problem.

When opening the attach dialog there is an option Attach to: Managed... with a Select button beside it. By default this was set to Managed (v4.0). Now I added Native code and this solved my problem. I can attach now locally as well.

I sure don't understand why this works on a remote machine, because the code is exactly the same though, so there shouldn't be such a difference.

Upvotes: 3

Related Questions