Remote Debugger Crashing on a local debug session - visual-studio-2010

I have a nunit DLL written in c++ and build for framework 4 for an x64 processor. I have nunit set up as my launch exe for debugging. From my understanding VS starts the remote debugger when having to debug x64 applications. For the last day or so the remote debugger monitor is crashing sporadically which is annoying. I have checked the event logs and there is no information other than a guid. If I could just restart the msvsmon.exe and restart debugging it would be on thing, but if I fire one up VS can't attach to it.
Any one have any clues as why msvsmon would start crashing.
Is there a way to force VS to reattach to a new instance.

Related

Visual Studio 2015 debugger closes application

Once I start any application from VS with debugger on Any CPU or x86, application exits immediately with exitcode 0. It works fine if I compile application for x64.
I have tried:
Reset VS Settings
Reinstall (repair) .NET
Check paths
Clean/Rebuild solution
Reboot PC
But it did not help.
What could be the issue and how to solve it?
The issue was in running regsvr process.
Once I shut down the proccess, debugging started working without issue.

Can't debug correctly Windows drivers with Visual Studio

I've written a Windows driver sample (WDM) with Visual Studio but I'm encountering issues when trying to debug it. The target is running in a Virtual Machine (VMware)
I've followed the documentation (http://msdn.microsoft.com/en-us/library/windows/hardware/hh698272(v=vs.85).aspx) to configure everything.
It's compiling fine but there are problems when debugging.
I have tried various configurations and have different problems on each.
Visual Studio 2013 Preview on Win7 (host) / Win8.1 Preview (target) - VMware
It seems the debugger isn't working properly. Indeed it's like if nothing was loaded, the Modules Window is empty, when I click on "Break all" nothing is happening. As you can see in the logs, the debugger session isn't created.
Screenshot:
Logs: http://pastebin.com/DfVzGR4Z
Visual Studio 2012 on Win7 (host) / Win8 (target) - VMware
It's working correctly at the first try but if I stop the debugger to modify the driver, it'll freeze the VM. I'll then have to restart the VM, Visual Studio and kill the process ntkd.exe because otherwise I have these errors:
Failure to create process instance prevents debugging
Unable to start (null), Error 80004005. (Unspecified error)
Followed by a crash of VS (Event Name: CLR20r3)
I've tried with other samples downloaded from the MSDN but it's the same problem.
I've been stuck on these issues for weeks and I'm starting to desperate, so any help would be appreciate. I haven't tried WinDDK but since VS has everything needed, I don't see why I couldn't use it normally.
I recommend to forget using Visual Studio for driver development/debugging because, on my opinion, is not solid enough.
But targetting the debugging process, it is better to install VisualDDK and then launch vmmon/vmmon64.
In the installed application you will find a folder named "target" with an application named DDKLaunchMonitor.exe, install it in the virtual machine (it will create a boot menu option to activate kernel debugging)
When you want to debug your driver, launch vmmon, activate the option to launch windbg at vm startup, start your vm and when windows boots it will load windbg and attach to the vm.
The install your driver as desired and learn windbg.
I know this answer does not solve you problem with VS but using windbg directly is faster and better.
I was having a similar problem with: Visual Studio 2015 Community Edition, Windows 10 host, Windows 10 target, VirtualBox with host only network.
Provisioning and remote driver deployment worked, but the debugger would not connect.
Edit: In the last step of provisioning in VS2015 the Host IP can be selected. The manual method below is an alternative.
The manual setup guide for kernel mode debugging says to run the following:
bcdedit /debug on
bcdedit /dbgsettings net hostip:w.x.y.z port:n
Visual Studio automatically runs these during the provisioning process. Notice the hostip parameter - this has to be the address of the connecting machine (the one with the debugger) on the interface it uses to connect to the target. Visual Studio may set this incorrectly if you have multiple network interfaces. In my case the VirtualBox host only network created the extra network interface.
Provision the target machine in VS, if you haven't already. Then run the two bcdedit commands above and reboot the target machine. After this, the debugger should connect properly.
I came across the same problem. The windbg connection is hang. I found there is something wrong in my configuration for Kernel mode debugger settings( Visual studio 2012 Driver->test->Configuration). I set the port simply com1. Actually, it should be \.\pipe\com_1.Then it works
In your case, there maybe other configuration problems. You can check through the points on webpage http://www.codeproject.com/Tips/545835/Kernel-Mode-Debugging-in-a-VM-using-Visual-Studio.

The 32-bit version o fthe Visual Studio Remote Debugging Monitor cannot be used to debug 64-bit processes?

I am trying to run my visual studio (2010) C++ project on an old Windows XP machine that is running VS2010. However, when I run it, I get the error listed in the title of this question. Why is this, and how can I fix it?
Same error was throwing for me when I had Silverlight debugger enabled. To resolve this issue
Open project properties
Under web tab look for Debuggers
Remove the tick mark on "Silverlight"
In general, a debugger should be the same bitness as the debuggee (or at least it must be able to understand the architecture of the target). In any common siutation, an x86-based debugger will not be able to debug an x64 application.
The Visual Studio documentation says:
To debug a 64-bit application that is running on a remote computer,
you need to install the 64-bit remote debugger on the remote computer.
The 64-bit remote debugger is available on the last disc of your
Visual Studio installation set.

Debugging on Windows7 64-bit

I am trying to debug my app, which was compiled for 32-bit, native code, under VS2005. It crashes on a Windows 7 64-bit machine. I can't figure out how to get a call stack to see where it's crashing. I installed VS2005 on the Windows 7 machine, ran my app, got my crash -- and the dialog had a "Debug" button on it! Yay! I hit the "Debug" button, and it didn't do anything. How do I need to configure this?
I was wondering if I have to be running a Debug build? I copied my debug binaries over, but they won't run because of "side-by-side configuration" problem; apparently it does not have the debug ATL, MFC, CRT stuff that my 32-bit app wants to use. How do I fix that?
If the debugger won't start after the crash, just attach the debugger before the crash (if possible):
Start the debugger
Choose "Attach to process"
And select your process
The process will possibly hang for a few seconds while the debugger loads all the symbol information.
If your application now crashes, the debugger will automatically stop at the place of the crash. If this doesn't happen, check the Exceptions dialog and enable the relevant exceptions.
When installing VS with defaults, it will not install the 64 bit debugger. You must go back to the installer, select a custom install, and expressly select the 64 bit debugger.

x86 Remote Debugger Service on x64

Is it possible to install the x86 Remote Debugger as a Service on a 64bit machine? I need to attach a debugger to managed code in a Session 0 process. The process runs 32bit but the debugger service that gets installed is 64bit and wont attach to the 32bit process.
I tried creating the Service using the SC command, and was able to get the service to start, and verified that it was running in Task manager processes. However, when I tried to connect to it with visual studio, it said that the remote debugger monitor wasn't enabled. When I stopped the x86 service, and started the x64 service and it was able to find the monitor, but still got an error.
Here is the error when I try to use the remote debugger:
Unable to attach to the process. The 64-bit version of the Visual Studio Remote Debugging Monitor (MSVSMON.EXE) cannot debug 32-bit processes or 32-bit dumps. Please use the 32-bit version instead.
Here is the error when I try to attach locally:
Attaching to a process in a different terminal server session is not supported on this computer. Try remote debugging to the machine and running the Microsoft Visual Studio Remote Debugging Monitor in the process's session.
If I try to run the 32bit remote debugger as an application, it wont work attach b/c the Remote Debugger is running in my session and not in session 0.
This works on my machine(TM) after installing rdbgsetup_x64.exe and going through the configuration wizard:
sc stop msvsmon90
sc config msvsmon90 binPath= "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe /service msvsmon90"
sc start msvsmon90
We had the same problem when trying to remote debug a website that is running as 32 bit inside 64 bit IIS.
You can also do this:
Stop the default debugging service
(which will be x64 as the installer
will have been clever and configured
that one to run).
Navigate to the Remote Debugger start
menu folder and run the x86 debugging
service. Ignore the warning about
32bit/64bit.
Open the Tools->Options window of the
remote debugger app window and make
note of the value in the 'Server
Name' text box.
Now you can attach your visual studio
to it by copying the 'Server Name'
value into the 'Qualifier' text/combo
box on the Attach To Process dialog
of Visual Studio.
On a related note, there is also a low-level bug with Kerberos authentication if you are attaching from Windows 2008/7/Vista to a 2003 machine, reported to MS (and then closed as 'external') via Connect here: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=508455
I haven't tried this, but here's a suggestion anyway:
Try installing the x86 remote debugger service manually.
sc create "Remote Debugger" binpath= "C:\use\short\filename\in\the\path\x86\msvsmon.exe /service msvsmon90"
Two notes:
You'll need to use short filenames
in the path to msvsmon.exe to
prevent having to quote the path
(since the whole command needs to be
quoted)
there must be a space after the
"binpath=" (and no space before the
'=' character). Whoever wrote the
command line parser for the sc
command should be cursed.
Then you can use the services.msc control panel applet to get it running with the right credentials.
You'll probably have to stop or maybe even delete the existing x64 remote debugger service.
I can confirm that what you want to do will indeed work. I often connect my 32 bit xp worstation to a x64 win2003 server with VS2008 remote debugger.
1) Install the x64 version. This also installs the x86 debugger but does not create a shortcut.
2) You can find the executable for x86 process debugging here... C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe
3) If you want to, pin it to the task bar.
Worked for me without installing additional software. I just copied the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger folder on the VM and started the msvsmon.exe from the x86 folder. Both my guest and host are x64.
Sometimes this error occurred, I just close visual studio and open it again, everything is OK!
Very strange behavior from vs
I ran into this issue today (64 bit OS and VS 2019). I changed Configuration to use x64 for the project, IISExpress to use 64 bit and Platform target to be x64. It still used the 32 bit debugger and complained. Finally, when I enabled Script Debugging it started using the 64 bit debugger. So I would say the combination of all did the trick.

Resources