DebugBreak not breaking
Solution 1
Finally I found the cause of the issue. It's a Vista/Win7 cause:
- Open The Action center control
- Goto Action Center settings
- Goto Problem Reporting Settings
- Choose "Each time a problem occurs, ask me before checking for solution"
Although this is more of IT solution/question I've been plagued with this problem all day and wanted to share the solution with other developers who encounter this problem.
Solution 2
I finally found the solution for Windows 10 here: https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/enabling-postmortem-debugging
And also: https://docs.microsoft.com/en-us/windows/desktop/Debug/configuring-automatic-debugging
To enable automatic debugger launch, you should add a registry value:
- key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug
, valueAuto
=1
(of typeREG_DWORD
)
The configured debugger is set the by the value Debugger
(type REG_SZ
); a Visual Studio installation sets this to:
"C:\WINDOWS\system32\vsjitdebugger.exe" -p %ld -e %ld
Note that on 64 bit OS this only works for 64 bit executables. To enable the same behaviour in 32 bit executables set the same values in this key:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug
Solution 3
In that case...
Here is the quick overview of what you need to-do to enable debugging on a Microsoft Windows 7 machine:
Update the Just-In-Time debugger setting DbgJITDebugLaunchSetting. The setting is found in the registry at [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
.
Set the value of DbgJITDebugLaunchSetting to 2.
If you are using a 64bit operating system then you must also set the same key (DbgJITDebugLaunchSetting) in this folder [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework]
to 2.
If you run into any issues try running CodeSmith Studio and Visual Studio as an administrator.
Now when CodeSmith enters a break point you will see something like this:
Jakub Krampl
Senior consultant with Extensive knowledge of C++, assembly, various .NET languages (c#, VB.NET) and Java. blog: blog.drorhelper.com I'm also a Pluralsight Author
Updated on June 02, 2022Comments
-
Jakub Krampl almost 2 years
I'm writing a class in C++ that I cannot debug by using F5. The code will run from another "service" that will invoke it. In the past I've used
__debugbreak()
and when I got a window telling me that an exception was thrown selected to debug it.Recently I've updated to windows 7 and it kept working for a while.
Today when I've tried to debug a piece of my code instead of shown the regular dialog that tells me that VSTestHost has stopped working and enable me to to debug the application I got a different dialog suggesting I send the data to microsoft for analysis.
Does anyone knows how can I fix this issue so I'll be able to debug my code?
-
Ferruccio almost 15 yearsSometimes that can be a problem because by the time you attach to the process your code has already gotten past that point. In those cases I find it helpful to put a Sleep(10000) right before the point I want to break. Gives me just enough time to attach to the process.
-
Jakub Krampl almost 15 yearsI'm not looking for another way to debug - I want ot fix the current why I'm debugging my code
-
Jakub Krampl almost 15 yearsGood find but I've managed to solve the issue without changing the value of the keys to 2 (by default its 16)
-
mlt about 8 yearsIt definitely stopped reporting on Win 8, but it doesn't offer to start debugger either. It just says Error 1067: The process terminated unexpectedly.
-
Emerick Rogul over 5 yearsThis helped me on Windows 10 (specifically the step to add "Auto"). Thank you!
-
ceztko over 3 yearsThese settings are for CLR debugging only. The question is about native C++ code.