Why does not load SOS.dll in VS 2013

2019-02-06 08:48发布

问题:

The SOS Debugging Extension that I use in VS2010, but now cannot use in VS2013. I guess, I have to any update or some stuff install for VS2013, right?

I try to like below in the Immediate Window;

.load sos

Invalid expression term '.'

.load C:\Windows\Microsoft.NET\Framework\v4.0.30319\SOS.dll

Unexpected character '\'

.load "C:\Windows\Microsoft.NET\Framework\v4.0.30319\SOS.dll"

Unrecognized escape sequence

.load C:\Windows\Microsoft.NET\Framework\v4.0.30319\SOS.dll

Unexpected character '\'

.load C:/Windows/Microsoft.NET/Framework/v4.0.30319/SOS.dll

Invalid expression term '.'

回答1:

This feature has been getting brittle since VS2012 and it doesn't exactly look like Microsoft intends to maintain it. Part of the problem appears to be integration of device driver debugging into VS, that's at least the hint I'm getting from this feedback article.

There's a setting that needs to be turned on to get it to recognize the .load command in the first place: Tools + Options, Debugging, General, tick the "Use Managed Compatibility Mode" checkbox. I had turned that off because it had undesirable side-effects.

That still doesn't help on my machine (could be an isolated issue), the command fails with "Error during command: Exception c0000005 occurred at xxxxxxxx". A problem I also had on VS2012. Maybe you'll have better luck, but long term I think it is wise to get familiar with Windbg.



回答2:

It's a bit buried in the new 'docs' documentation structure...

Debugging Managed Code Using the Windows Debugger
https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-managed-code


"You can use the windows debuggers (WinDbg, CDB, and NTSD) to debug target applications that contain managed code. To debug managed code, you must load the SOS debugging extension (sos.dll) and a data access component (mscordacwks.dll).

"The windows debuggers are separate from the Visual Studio debugger. For information about the distinction between the windows debuggers and the Visual Studio debugger, see Windows Debugging."