I am currently trying to launch a debugger for a process that is launched externally (not from within visual studio). I cannot seem to get a debugger actually launch, as it appears nothing happens. In the process, I added this code:
Debug.Assert(Debugger.IsAttached == false, "Should be no debugger");
if (!Debugger.IsAttached)
{
Debug.Assert(Debugger.Launch(), "Debugger not launched");
}
Debugger.Break();
Debug.Assert(Debugger.IsAttached == true, "Debugger should be attached");
The asserts are there to verify that I'm not crazy. At first, the IsAttached property returns false as I expect. I then call Debugger.Launch, and that returns true. As per the MSDN documentation of Debugger.Launch, it says it will only return true if it succeeds in launching the debugger, or if one is already attached. I verified one was not attached, so it must have launched one.
The break-point never gets hit, and the second verify fails (the IsAttached property returns false). I also attempted to put a sleep in after Debugger.Launch to give it some time, to no avail.
Any suggestions?
I have the same problem in Visual Studio 2013 Premium. The Eric answer put me over how to resolve it. But you don't need to change the register.
- Go to Tools --> Options --> Debugging
- Open the item and select just in time debugger
- If you see in the low part of the window a yellow
warning about that other debug is being used different to visual
studio. If you see that, check all Just in Time checkboxes to return
to VS to be the debug program.
That is all.!
Options Just in Time debugger
That is a lame answer, since I can't find any reference to VS Express in the question and I had the same problem while using VS2013 Pro.
Even though this article sais the issue is solved in VS2013, even if you are using VS2013 like me, look for the temporary fixes tab listed there. I fixed the issue using it. More info in the link.
I'll just link another article which put me in the right direction, perhaps it's useful too.
Summary: Change the AppIDFlags value of the Visual Studio Just-In-Time Debugger registry key from 0x28 to 0x8 (or 0x20 according to the article above, trial and error I guess) They registry key is HKEY_CLASSES_ROOT\AppID\{E62A7A31-6025-408E-87F6-81AEB0DC9347}
Perhaps this will helps someone in the future. I had the same issue, that Debugger.Launch didn't appear to do anything. Turns out that someone else was logged into my machine and the debugger attach promped launched in their environment, not mine. I kicked them out of the system and that fixed it.
The answer: Visual Studio 2010 Express
Express does not support (without a level of hackery) attaching to a process to debug it. This means that the Just In Time Debugging features are not available. I assume this is also what causes the Debugger.Launch to fail (though it returns true, and I'm assuming that's because it technically attempted to show a dialog, but no debuggers were installed).