Vistual Studio: __debugbreak() doesn't offer the option of debugging a program - visual-studio-2010

On most of my machines if I have a __debugbreak(); statement in my program Windows will pop up a dialog saying "dummyService.exe has stopped working. Windows can checkonline for a solution to the problem" and shows three options underneath:
- "Check online for a solution and close the program"
- "Close the program"
- "Debug the program"
This is very useful when you want to debug services that arelaunched by other programs. I don't remember doing anything special to get this behavior on my system. On another machine with a similar configuration, when the service is launched I don't get the usual dialog with these 3 options, instead the dialog simply says "dummyService.exe has stopped working. Windows is checking for a solution to the problem." and shows a progress bar. No options are shown. After a few seconds, the progress bar stops and a second dialog pops up saying "Do you want to send more information about the problem?".
This happens on Windows 7 Enterprise SP1 with Visual Studio Ultimate SP 1 installed. I suspect that this machine is missing either some registry setting or some options in Visual Studio that enables this debugger attach behavior.
Any tips on how to fix this annoying behavior would be greatly appreciated.
Thanks!
Florin

You need to set visual studio (or any other debugger) as the default JIT debugger. This can be done via tools -> options -> debugging -> Just-In-Time, then selecting native and managed and clicking ok

Related

Visual Studio hangs at Review Solution Actions dialog

When trying to open an older C++ project in Visual Studio 2019 Professional, I keep getting this "Review Solution Actions" dialog that hangs Visual Studio.
I've tried starting in safe mode and resetting my user settings but neither of those have done anything.
Once this dialog shows up it just hangs here and I cannot focus on this dialog or Visual Studio. It's as functional as the image of it posted in this question.
I can successfully "End Task" in Task Manager (as opposed to killing the process) so it's still doing something in the Windows message loop (and redrawing)-- but strangely won't obtain focus or allow drags. Haven't seen that before.
Is there a way to retarget this project via the command line? Is there something else I can do?
Version: VisualStudio.16.Release/16.4.5+29806.167
Updating to 16.5.2 resolved this, thankfully.

How to close a crashed Visual Studio debugger?

I feel pretty ridiculous having to ask this, but is there an easy way to close Visual Studio while it's debugging?
I'm debugging my application, and when switching to full screen it crashes. I am unable to alt-tab to visual studio to stop the debugger, and I'm unable to pull any other windows on top of the full screen application.
I can, however, see the start bar. I can right click on visual studio and click close, but it does nothing (same goes for the debugging application).
I'm unable to get the task manager to show in front of the full screen application.. However, I'm on Windows 8 and I've noticed the Metro interface still works (and all metro apps). If I could find a little command prompt metro app I'm sure I could get around this, but I'm unable to.
Is there an easier way to resolve the issue without having to restart my pc each time I crash?
Almost forgot to mention, I'm on Visual Studio 2013
Edit: Forgot to mention, I'm programming on-the-go on a laptop; I only have the one monitor for this situation
I found a solution:
I can toggle focus to Visual Studio via Windows' Alt-Tab hotkey. This won't bring up Visual Studio, though.
Usually the problem is an unhandled exception, which requires me to hit "break." Since I gave Visual Studio focus, I can hit enter to select break.
I then use the Shift+F5 hotkey to stop the debugger
You might be able to use Developer Command Prompt - see MDbg.exe (.NET Framework Command-Line Debugger) to debug and kill your process

Visual Studio 2012 Won't Run Program w/ Debugging

This is the error message I'm getting:
Error while trying to run project: Unable to start program 'C:\devcode\ActiveLegacyApplications\lvLabCumFTP\bin\Debug\lvLabCumFTP_Converted.exe'.
Operation not supported. Unknown error: 0x80040d10.
I have cleaned/rebuilt the solution, changed CPU target from x86 to AnyCPU, and rebooted the PC. The program runs if you launch without debugging or manually from directory. I'm lost on what to do next...I've looked at about 5 other similar issues.
I did have a failed Update on Visual Studio (update 3), but it was working fine when I left work yesterday which was after the failed update....this all started when I came in this morning.
Please help!
In some cases running Visual Studio as Administrator does not solve the problem.
I experienced this with ArcMap.exe (ESRI ArcGIS 10.1).
The following made it working for me:
Find executable file in Windows Explorer
Right click on it and select "Troubleshoot compatibility"
Choose "Troubleshoot program" (not "Use recommended settings")
Check all four checkboxes and click "Next" button
Select Widows XP (Service Pack 3) and click Next - probably it could work with Vista also but I haven't tried this out and therefore cannot recommend
Click on "Test program" button - it will launch the executable
Close program and click on "Save changes"
If it is already saved any compatibility settings as a result of previous attempts to make the program working as intended, I would recommend to use the same scenario (use the same Troubleshooting master) for removing them prior to trying out the suggested approach.
Run Visual Studio as admin and it will works correctely

VS attaching to process disabled

A few days ago, the attach button in "Attach to process" dialogue became disabled in VS 2010 and VS 2008 likewise. At first I thought that it is just an extension I've installed in VS 2010 but then I noticed it is the same in VS 2008. The both VS's a re running in administrative mode and on Windows 7.
I looked around but I can't seem to find a solution to this.
If anybody has encountered an similar problem, a little help would do great.
Thanks upfront.
EDIT: Attached a picture of the dialogue!
Where it says
you should press 'Select' and ensure at least managed is ticked. (or choose automatic)
otherwise, the 'Attach' button will be disabled.
It could also be because there is already another debugger attached to the process - probably the currently running instance of Visual Studio but it may be another instance of Visual Studio, or another debugger entirely (such as WinDbg or a remote debugging session).
Check the "Processes" window (usually found under Debug -> Windows -> Processes) to see what processes Visual Studio is debugging.
Try stopping Visual Studio but don't close the process.
I have come across a weird situation under which Attach button was disabled. This was because of DebugDiag. Please refer the following thread for info.
I was trying to debug a windows service as described here and had the same issue. The solution was to run Visual Studio as Administrator and select to see processes from all users.

How to stop "Just In Time Debugging" messages blocking a buildserver

Our buildserver (TeamCity, much recommended), runs our a whole bunch of testsuites on our finished c++ program.
Once in a whole, a test causes our program to crash, often bringing up a VisualStudio dialog offering me to JustInTime debug the crash. The dialog stops the buildserver from progressing. Instead of the build marked as failed, it just hangs. I've turned off the Just In Time debugging feature in VisualStudio, but when it's turned off, you still get a message "Couldn't JustinTime Debug this, you can turn it on in the options".
Does anybody know of a way to ensure that any unhandled exception in a program does not result in any modal dialog?
This MSDN article explains how to disable Just-In-Time debugging on a Windows server. I've included the relevant portion of the article below:
After Visual Studio is installed on a server, the default behavior when an unhandled
exception occurs is to show an Exception dialog that requires user intervention to
either start Just-In-Time debugging or ignore the exception. This may be undesirable for
unattended operation. To configure the server to no longer show a dialog when an
unhandled exception occurs (the default behavior prior to installing Visual Studio), use
the registry editor to delete the following registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger
On a 64-bit operating system also delete the following registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\DbgManagedDebugger
Delete (or rename) c:\windows\system32\vsjitdebugger.exe.
I tried deleting the registry keys, and I tried unchecking all the boxes in the Visual Studio options, but neither worked.
To be clear, my situation wasn't a C++ one. I was using Micro Focus COBOL for Visual Studio 2010, and by using the registry and VS options suggestions I managed to get rid of the "Want to debug?" dialog, but that resulted in a different dialog to hold up my automated process:
Visual Studio Just-In-Time Debugger
An unhandled exception ('COBOL runtime: Fault detected') occurred in CASDBC.exe [3564]. Just-In-Time debugging
this exception failed with the following error: No installed debugger
has Just-In-Time debugging enabled. In Visual Studio, Just-In-Time
debugging can be enabled from Tools/Options/Debugging/Just-In-Time.
Check the documentation index for 'Just-in-time debugging, errors' for
more information.
OK
I would not recommend to edit/remove regs. Usually the registry is a mess to play with.
The solution that helps me is a quite simple. I`ve just added JIT debugger to my Visual Studio. Steps are:
Open Windows Control panel
Programs
Programs and Features
Find Visual Studio 2017
Click Change. On a new opened window navigate to the Individual Components tab
Check Just-In-Time debugger checkbox
Click modify
After VS reload the error should be fixed.
In my case , on win2012 server, I tried:
removing registry keys
deleting the exe for the jit debugger from c:\windows\system32
and it still came up!
I rebooted, etc.
Was making my web site in IIS stall until dialog was acknowledged!
Final solution, which did work: In control panel, in Programs: Uninstalled "Microsoft Visual Studion 2010 Shell (Isolated)" Uninstalled that, and problem solved.
(Whether SQL Management Studio still works.... I do not know!)
In the Window for the question
Do you want to Debug using the selected debugger?
Click YES (new window opens) > OPTIONS (top row menu) > DEBUG
Then in the New window remove the TICK which shows ENABLE JUST IN TIME DEBUGGER.
After disabling the JUST IN TIME debugger close the window or click OK
Your problem will be solved. I've tried this and got rid of the JUST IN TIME POP UP messages.
Best Solution for this problem is so simple
2 steps to make it done
open cmd prompt
type : regedit
go to path-->HKEY_LOCAL_MACHINE-->SOFTWARE-->Microsoft-->Windows NT-->CurrentVersion-->AeDebug
You can find now the file : Debugger
right click , Modify
copy and paste this text inside it:
drwtsn32 -p %ld -e %ld -g
click ok and voila :)

Resources