Launching "Visual Studio Just-In-Time Debugger" without prompting - visual-studio

I have set up my system to automatically attach the visual studio debugger when a certain application is launched using these instructions:
http://msdn.microsoft.com/en-us/library/a329t4ed%28printer%29.aspx
The problem is that I get a dialog box each time that requires me to confirm that I do indeed want to attach the debugger. The dialog also prompts me to specify which visual studio debugger I want to attach (I have VS2003, VS2005 and VS2008 installed on the system). I've selected "New instance of Visual Studio 2008" and checked the "Set the currently selected debugger as default."-box but the dialog keeps popping up.
Thanks
Andreas Brinck

There is a registry entry that determines how the debugger is started. Under
HKLM\Software\Microsoft\Windows NT\CurrentVersion\AeDebug
create a DWORD value named "Auto" with a value of 1, so no confirmation window displays

Related

Make Visual Studio 2019 Always Run as Administrator from Start Bar Recent Solutions List

I recently upgraded to Windows 10 and Visual Studio 2019.
Prior to the upgrade, Visual Studio 2017 would always run as Administrator. I did not think much of this, but now that it is gone it is causing me problems.
The primary one is that it will not load my projects that use my local instance of IIS.
I usually launch Visual Studio from my start bar. Right now this goes like this:
Right click on the icon on the start bar and select my solution.
It loads and then I realize that the main project did not load.
Close visual studio, open as admin
Pick my solution and then it loads.
I would really like to only have to do #1 above. Is there someway I can edit the shortcut on the start bar to have it always launch as Administrator?
Turns out that Visual Studio uses different permissions when you click on the list of shortcut options it offers in the start menu. (IE to load a recent solution directly.)
Selecting the Properties->Advanced->"Run as Administrator" did not cause these to run as administrator.
But this did it:
Find devenv.exe (Visual Studio's executable)
Right Click on it and select "Troubleshoot Compatibility".
On the Program Compatibility Troubleshooter window, click on Troubleshoot Program
Check that the program requires additional permissions and click Next
On the next window, click on Test the program… and VS will open as administrator
Click next and then click on Yes, save these settings for this program
Now Visual Studio will ALWAYS run as administrator.
(Taken from: https://ppolyzos.com/2017/08/08/always-run-visual-studio-as-administrator/)

What do I do to run Windbg/dbeng.dll commands from within the Visual Studio debugger and the Immediate Window?

I saw in a video talk by Bart de Smet where he was running Windbg commands by typing them into the Immediate Window in Visual Studio when running the project in debug mode inside the Visual Studio debugger.
So, I wanted to try that myself. So here's what I did:
I went to the Project Properties dialog and then selected the Debug tab, then checked the Enable native code debugging in the Enable Debuggers section.
I set a breakpoint on one of the lines and then launched the project with debugging by hitting F5. When the breakpoint was hit, I opened the Immediate Window and typed the .load command to load sos.dll.
But the message I got as a result read:
.load "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\sos.dll"
error CS1525: Invalid expression term '.'
Is there something else I need to do?
I am using Visual Studio 2015 Community edition.
Run your application without debugging
Choose Debug/attach to process ...
Choose "Windows User Mode Debugger" as transport
Click "Refresh"
Choose your application
Click "Attach"
Open the "Immediate Window", which will labelled be "Debugger Immediate Window"
Enter WinDbg commands

How to Fix Unrecognized Guid format in Visual Studio 2015

I'm getting an "Unrecognized Guid format" error when I try to open my project in Visual Studio 2015 on a Windows 10 machine (upgraded from Windows 7).
This did not always occur for me. I originally made VS studio open as administrator (because my project needed it at the time) by following the steps in the anwser here: Can you force Visual Studio to always run as an Administrator in Windows 8?
I then decided I wanted to switch back to not having it open as admin. To try and switch back I again ran the compatibility troubleshooter, this time I selected "try recommended settings". After doing this I am now getting the Guid error every time I open my project and I can no longer run it. I even get it if I open VS as admin like I did before.
I even tried uninstalling Visual Studio and reinstalling it but that did not work either.
I am guessing you used to run Visual Studio as Administrator. This did it for me. The answer is to delete the compatibility entry in the registry.
Type Windows+R on the keyboard to open the Run dialog
Type regedit and press enter
Browse to HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Delete the Visual Studio entry
I fixed this on Windows 10 by using the Troubleshoot compatibility tool. It has to do with an extra checkbox being enabled.
Navigate to devenv.exe by right clicking Visual Studio from start, click
properties, and select "Open File Location...".
Right click on devenv.exe and select "Troubleshoot Compatibility".
Click "Troubleshoot Program"
Uncheck "it worked with older versions of windows"
Click "Next"
Click "Test the program"
Confirm everything opens correctly
Click "Next"
Click "Yes, save these settings for this program"

Visual Studio 2012 MSVSMON.EXE does not work

I'm really tired of this error.
Most of the time, when I want to debug the program , I'm faced with this message.
Microsoft to offer solutions, but it is quite confusing:
1.
Make sure the Visual Studio Remote Debugging Monitor is installed and running on the remote machine.
2.
Make sure the Remote Server Name is correct in the Name box in the Project Properties dialog box.
3.
Verify that the remote machine is accessible on the network.
please someone help and guide me because all of my projects have been suspended and i need visual studio debugging.
meanwhile, when i dc from internet, visual studio will work.
Windows 7 x64, VS 2012, VB.NET
I fixed it like this:-
Create a shortcut on your desktop to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe".
Right-click shortcut and select "Properties" from the dropdown menu.
Select the "Compatibity" tab
Tick "Run this program as administrator"
Click OK
Create a shortcut on your desktop to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe".
Right-click shortcut and select "Properties" from the dropdown menu.
Select the "Compatibity" tab
Tick "Run this program as administrator"
Click OK
To start VS2012:-
1) Double-click the msvsmon shortcut icon (that you created above, to launch msvsmon)
2) Double-click the "Visual Studio 2012 Professional" shortcut icon (that you created above, to launch VS2012)
3) In VS2012, ensure standard toolbar is visible.
4) In VS2012, ensure "Solution Platforms" dropdown (on standard toolbar) is visible and set to "x86".
and ... wowee ... debug works !
I had the same problem. I fixed changing in properties/compile/target platform to x86 instead of Any CPU. It was the problem in my case. Hope it helps.
I got this error when starting VS2012 as a normal user. When starting as an administrator it opened up a UserControl TestContainer window instead.
What have happend was that the startup project was changed. I changed back to my ordinary startup project by right-click on it and choose "Set as StartUp Project".
I have started vs 2012 as administrator and it is fixed

Visual Studio - Attach to process shortcut

When I want to debug I have to do Debug->Attach to Process -> Look for a process in the list -> Attach.
I was wondering if I can create some kind of a shortcut to do this for me?
The shortcut is Ctrl+Alt+P in Visual Studio 2005 and above.
The easiest way to do this is to write a macro which finds the DTE.LocalProcess you wan to target and automatically attach. For example
Public Sub AttachShortcut()
For Each proc In DTE.Debugger.LocalProcesses
If proc.Name = "what you're looking for" Then
proc.Attach()
Exit Sub
End IF
Next
End Sub
Note: This Stack Overflow Question is related and has a sample you may find useful
Attaching to a child process automatically in Visual Studio during Debugging
To enable the 'Attach to Process' toolbar button in Visual Studio 2013, 2015, 2017, 2019, and 2022
Right-click on any toolbar and click 'customize...'
Click the 'commands' tab
Click the 'Toolbar' radio button
Select the toolbar where you want your button to appear from the dropdown
Click the 'Add Command...' button
Select 'Debug' from the categories list on the left
Select 'Attach to Process' from the commands list on the right, and click ok. The button will appear on your selected toolbar.
Optionally, use the 'Move Up' and 'Move Down' buttons on the right to move your new button to your desired location within the toolbar. I keep mine just after the Debug button.
You can use the Alt key shortcut ALT+D,P to launch the "Attach to Process" window via Debug menu.
Once there, you can use your keyboard to search the list of Available Processes (e.g. type "w3wp" if you want to attach to an IIS app pool)
Writing a macro is one option, however it cannot deduct which process to attach to by itself.
Another nice solution is to map the "Attach to process" command to a shortcut key:
(Tools -> Options -> Environment -> Keyboard, type attach, like i did in this example, and select a shortcut key):
This answer should work for Visual Studio 2010.
I like having buttons to do this on my debug toolbar
https://gist.github.com/1406827
The gist contains a method for attaching to IIS (w3wp.exe) or ASP (aspnet_wp.exe) and also nunit (nunit-agent.exe). Instructions are included on how to add the macros to your debug toolbar.
For Visual Studio 2017, 2019, there is a ReAttach extension available. Very handy.
I use this built in "Shortcut"
ALT+D, P, W, ENTER
this opens the debug menu, selects attach to process, scrolls down to w3wp.exe and attaches.
It's long but should work in multiple visual studio versions with no setup required, with or without resharper and it works when running multiple IIS processes as you can choose which process to attach to.
Addins are probably a better way to do this now. I use one called "Attach to anything". You can find them in Visual Studio 2012. Go to "Tools" -> "Extensions and updates", search for "attach", and install "attach to anything".
Also see:
Automate "Attach to Process" in Visual Studio 2012
Alt+Shift+P to reattach the last attached process.
It works for me in Visual Studio 2017.
Personally I prefer to use Debugger.Launch() as suggested here
in this thread, because it doesn't need for references to the DTE (that's IDE-specific and must be explicitly referenced into the project to be used)
VS extensions
Debug Attach Manager
ReAttach
Resurrect
More: Search the VS Marketplace for "attach"
Keyboard
The attach to process shortcut is Ctrl+Alt+P in Visual Studio 2005 and above. You can then press the first letter of the process name you want, e.g. w for w3wp.exe and it'll jump to that, then Enter to attach.
You can use the Alt key shortcut ALT+D,P to launch the "Attach to Process" window via Debug menu.
Code
Add System.Diagnostics.Debugger.Launch() to your code
Current release is VS2015 at time of writing.
Go ahead and edit/extend this answer :-)

Resources