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

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 :)

Related

Just my code - Visual Studio 2010

I have enabled Just My Code in the debugging options, but it says it's for managed only.
When I have the debugger in the managed mode, it runs but closes straight after and I can't step into each line of code.
How can I make it work?
When Just My Code is enabled, it is possible to choose Break on the Debug menu and stop execution at a location where there is no My Code to display. When that happens, no code is displayed. Additionally, if you choose a Step command, it will take you to the next line of My Code.
First try to read How to: Step Into Just My Code and then will understand what they do.
As you're saying that debugger is not running, there might be many reasons:
You could type Devenv.exe /SafeMode, which starts Visual Studio in safe mode, loading only the default environment and services.
If it does not work, you could type Devenv.exe /resetsettings. It restores Visual Studio to default settings. Optionally, reset the settings to the specified .vssettings file.
More information about the Devenv.exe command line.
Switch other accounts or create a new account and try it again.
If it doesn’t work still, please uninstall Visual Studio via Add/Remove Program thoroughly and reinstall it again.

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

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

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.

Visual Studio 2008 Designer File Bug?

This has been driving me crazy for months. I have a multiple projects that compile without errors. If I start copying and pasting controls (or even just plain 'p' tags) the designer will fail 1/2 the time with the error "the method or operation is not implemented". The complexity of the page doesn't matter. The 'solution' is to delete the designer file, exit visual studio, open visual studio and convert the offending aspx file to a 'web application' to regenerate the designer file.
This is a really annoying. I can't find any fixes on Google. Is there a way to disable the automatic designer file? Make it so it only generates on a 'build' command and not fail everytime I'm laying out a aspx page?
Thanks
To find the fix for the issue you would need to find the cause of the issue. It might be possible to get more information on what is causing the issue if you attach a debugger to Visual Studio. This could be done by following these steps:
Open two instances of visual studio (run as administrator)
In one, open your project and get to a point right before the issue occurs
Attach the other instance of Visual Studio to the one with your project (Tools -> Attach to Process)
Perform the steps to reproduce the issue.
Note that to actually catch the exception you will need to change a few debugging options. First you would need to make sure that the Just My Code check box is unchecked in the General debugging options in Visual Studio. The second is on the exceptions dialog you will need to catch thrown exceptions. The exception dialog is under the Debug menu in Visual Studio.

Visual Studio 2005 - can not open form on designer

My team developed a GUI application on Visual Studio 2005, managed C++. Since some deliveries it is not possible to open the form in the designer, even if the source code and the project settings have not been changed. The designer reports this error:
Exception of type 'System.OutOfMemoryException' was thrown.
at Microsoft.VisualStudio.Design.VSDynamicTypeService.ShadowCopyAssembly(String fileName)
at Microsoft.VisualStudio.Design.VSDynamicTypeService.CreateDynamicAssembly(String codeBase)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description)
...
We successfully recompiled the project but we still encounter this problem.
Any idea?
This is how I used to debug these issues, Start a second instance of visual studio, load your project and attach to the first instance which also has the project loaded. Now set a breakpoint in the constructor and Page Load events and also any custom paint events that you may have in the form in the second instance and try to open the designer in the first instance, the breakpoints should get hit and you should be able to see what's going on.
I suspect that you have a Design Mode error where an infinite loop (or recursive control creation) occurs on the concerned Form.
One thing that helped me in these kinds of error on Windows Forms would be the following:
Open your Visual Studio 2005 solution for your GUI application. Don't open your form yet
Open another instance of Visual Studio 2005
In the second instance, Attach (Debug -> Attach to Process) the first instance of devenv.exe to the debugger. Make sure exceptions (Debug -> Exceptions) have all exceptions checkboxes under "Thrown" checked.
Now go to your first VS2005 instance and open the form. The second VS2005 instance will stop at the line where the error occurs.
This is a long shot, but try closing and opening the designer several times in a row. I have had the same kinds of problems with the C# Windows Forms designer (VS2005) : the form usually ended up opening correctly (after 5 tries, quite consistently).
I've run into the same issue intermittently when working with a large multi-project solution, or a project with an exceedingly large and complicated windows form.
I was able to solve the problem by enabling Visual Studio to use more than 2GB of memory. Here's the process...
(note: this assumes XP and Visual Studio 2005 - Vista and/or VS2008 will require slight changes)
Edit Boot.ini
Right-click My Computer, properties, Advanced tab. Under Startup and Recovery click Settings. Click the Edit button, and add the /3GB switch to the end of the [operating systems] line:
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect /3GB
Make Visual Studio "Large Address Aware"
Run a Visual Studio Command Prompt, and change to the IDE directory:
cd %ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE
Use the microsoft tool editbin to modify devenv.exe:
editbin /LARGEADDRESSAWARE devenv.exe
Now reboot, and you're done!

Resources