Automatically Load the Right SOS for the Minidump

Don’t you just love the following error message when trying to debug a minidump with SOS and WinDBG?

The version of SOS does not match the version of CLR you are debugging.  
Please load the matching version of SOS for the version of CLR you are debugging. CLR Version: 4.0.30319.1 SOS Version: 4.0.30319.235

SOS is built as part of the framework, so if you have a newer version of .NET on your machine than was running on the machine where the minidump was taken, you are completely out of luck. I guess you could set up a VM, install the original RTM .NET version and copy the SOS out of the framework directory. Lather, rinse, and repeat for each and every hotfix and service pack and you will eventually have all of the SOS.DLLs saved off. What would be nice is if the debugger would just get the right one every time.

This week I was working a fantastic group at Blizzard and we ran into something undocumented that we thought was awesome. WinDBG can download the right version of SOS if you get everything set up right. This seems to work for .NET 4.0 (but only post RTM builds) and .NET 4.5.

All my testing was with the latest WinDBG 6.2.9200.16384 from the Windows 8 SDK that you download here. The super important part to get SOS automatically downloaded is that you have to have the Microsoft symbol servers set up in the _NT_SYMBOL_PATH environment variable. The easiest way to do that is to use my WintellectPowerShell module to run the Set-SymbolServer cmdlet with the –public switch. WintellectPowerShell is freely available at GitHub.

Once you have the minidump loaded, the trick is to run !analyze –v. With the symbol server set up, the !analyze command will grab the correct version of SOS from Microsoft because that’s how it does the analysis! The downloaded SOS will be put into your local symbol cache and loaded from there. Here’s what the extension chain will be after running !analyze.

0:016> .chain
Extension DLL search Path:
      c:WinDBGWINXP;c:WinDBGwinext;c:WinDBGwinextarcade;…
Extension DLL chain:
     C:SYMBOLSPUBLICsos_AMD64_AMD64_4.0.30319.18046.dll5155291195e000sos_AMD64_AMD64_4.0.30319.18046.dll: image 4.0.30319.18046, API 1.0.0, built Thu Mar 28 22:29:32 2013
         [path: C:SYMBOLSPUBLICsos_AMD64_AMD64_4.0.30319.18046.dll5155291195e000sos_AMD64_AMD64_4.0.30319.18046.dll]
     dbghelp: image 6.2.9200.20512, API 6.2.6, built Thu Sep 06 22:45:49 2012
         [path: c:WinDBGdbghelp.dll]

     ext: image 6.2.9200.20522, API 1.0.0, built Fri Sep 21 01:17:05 2012
         [path: c:WinDBGwinextext.dll]
     exts: image 6.2.9200.16384, API 1.0.0, built Wed Jul 25 19:15:20 2012
         [path: c:WinDBGWINXPexts.dll]
     uext: image 6.2.9200.16384, API 1.0.0, built Wed Jul 25 19:15:09 2012
         [path: c:WinDBGwinextuext.dll]
     ntsdexts: image 6.2.9200.16384, API 1.0.0, built Wed Jul 25 19:16:01 2012
         [path: c:WinDBGWINXPntsdexts.dll]

Having fought the battle of the SOS version many times, this little trick will save us all a ton of time.

2075

The Right Solution for Your Needs.

We deliver a hybrid spectrum of Microsoft Cloud Platform and Azure solutions to government agencies and application developers who demand a modern, open and flexible cloud service platform. We offer trusted, transparent, and secure Infrastructure as a Service (IaaS) and Platform as a Service (PaaS) solutions for production business applications, Business Intelligence (BI), continuous data protection, application availability, test/development, and Software as a Service (SaaS)

Architected to meet your needs.

Deployed flawlessly.

Operated reliably 24x7x365.

Assess:

Rely on our team to map your existing environment to a corresponding Azure cloud.

Migrate:

Easily move from your existing environment to a public or private Microsoft cloud.

Re-platform:

Understand how to transform your applications to better take advantage of cloud capabilities.

Operate:

Our team actively manages all maintenance & optimization to keep your environment running at its best.

Why Microsoft Cloud Platform and Azure?

Microsoft has made major strides in the public cloud space over the past few years. They are gaining market momentum with companies and also the analysts community who recognize the more than USD15B investment made. At this point Azure has more data centers than AWS and Google Cloud combined. It spans an unparalleled global reach with 36 regions available and more being added. Azure offers companies wanting to put workload in the a public cloud with a secure, scalable and competitive option.

2111

Azure Certified for Hybrid Cloud.

Atmosera has developed core competencies and intellectual property to take full advantage of all Azure has to offer. All Atmosera Azure services receive the “Azure Certified for Hybrid Cloud” designation which confirms it passed Microsoft’s rigorous validation process under the Cloud OS Network (COSN) program. Customers benefit from knowing that their solution was carefully planned and executed using best practices and proven methods.

Stay Informed

Sign up for the latest blogs, events, and insights.

We deliver solutions that accelerate the value of Azure.
Ready to experience the full power of Microsoft Azure?