Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOS commands fail while live debugging a process which has multiple versions of CLR loaded

Tags:

windbg

sos

I have a ASP.net 2.0 application that I am trying to debug live using Windbg and SOS.dll. When I attach the debugger to the process, I see it loads both 2.0 and 4.0 versions of CLR.[ mscorwks.dll and CLR.dll].I load my SOS by - .loadby sos mscorwks. After this, none of my SOS commands work. I get "Failed to request threadstore", "Unable to get info from System domain" etc.

I learnt this is due to the mismatch in the mscordacwks.dll for the different version of CLR. But all the solutions that I found on google around loading the right version of mscordacwks using cordll command failed to solve my problem. Particularly, I have used .cordll –ve –lp but doesnt seem to make any difference. Upon executing "!threads" commads again, I get

"CLR DLL status: Loaded DLL C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscordacwks.dll

Failed to request threadstore"

I have seen another entry in stackoverflow around this problem. But luckily for him the problem disappeared before a solution was suggested and also this is not a duplicate of this entry

Any clue to help me use SOS exention with 2 versions of CLRs loaded into my process would be greatly appreciated.

MSCORDACWKS versions loading behaviour is as follows -

**0:033>** .cordll -e 
CLR DLL status: Loaded DLL C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscordacwks.dll 
**0:033>** .cordll -ve -u -lp C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscordacwks.dll
 CLR DLL status: No load attempts 
**0:033>** .cordll -e
 CLR DLL status: No load attempts
 **0:033>** !threads 
CLRDLL: Loaded DLL C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscordacwks.dll Failed to request ThreadStore 
like image 770
Mallika Ravi Avatar asked Mar 03 '11 07:03

Mallika Ravi


2 Answers

I had the same problem and had contact with Microsoft. Using the latest version of windbg, the on that was released during the BUILD conference, I was able to load the .net 2 version of the data access library.

The Windbg version is included in the Windows 8 driver kit. I was able to load the mscorwks data access library using the following command:

.cordll -I mscorwks -lp <path to mscorwks dll>
like image 122
Jonne Kats Avatar answered Oct 01 '22 01:10

Jonne Kats


It has been discussed already by long time Microsoft support guys,

http://blogs.msdn.com/b/asiatech/archive/2010/09/10/how-to-load-the-specified-mscordacwks-dll-for-managed-debugging-when-multiple-net-runtime-are-loaded-in-one-process.aspx

like image 31
Lex Li Avatar answered Oct 01 '22 01:10

Lex Li