I hope that all of you had a chance to participate in my session on the “Underappreciated Features of Microsoft SQL Server” during the Exclusive SQL Server Webcast series on Security & Scalability. If not, I trust the recorded sessions would be up soon for you to see. I will share the location of the same once available.
During the session, I demonstrated the T-SQL Debugger (http://beyondrelational.com/blogs/nakul/archive/2011/02/02/t-sql-debugger-underappreciated-features-of-microsoft-sql-server.aspx). A week before the session, I received a new laptop from IT. I was planning to conduct the demos from the same, and hence went about testing them and running through them as if it were a live session.
But, all was not good. As soon as I started the T-SQL Debugger demo, I encountered the following error:
Microsoft SQL Server Management Studio
Unable to start program ‘MSSQL:://MyInstance/master/sys/=0’.
A debugger dll, msdbg2.dll, is not correctly installed. Please repair your Visual Studio installation via ‘Add or Remove Programs’ in control panel.
If the problem persists, you can manually register msdbg2.dll from the command prompt with ‘regsvr32 "%CommonProgramFiles%Microsoft SharedVS7Debugmsdbg.dll"’.
The issue in my case was a bad dll (a problem we know as “dll ghost”). Here’s how I troubleshot the error:
- Navigate out to the location mentioned – “%CommonProgramFiles%Microsoft SharedVS7Debug”
- Confirm that the dll – msdbg2.dll is present at the location
- Right click on the dll and note the version of the dll
Because we know that the SQL Server 2008 R2 uses the Visual Studio 2008 shell, the dll version should at least be a 9.xx.xxx. Unfortunately, in my case, it was: 7.10.3077.0 – which is a very old version.
I had to do the demo and most of the laptop had already been configured for my day to day activities. Therefore, I looked around for a “healthy” installation of the SQL Server and checked the version of the dll there. The version was exactly as expected:
So, what do I do?
- Close the SSMS instance
- Unregister the existing dll by launching the Command Prompt under the Administrator mode and using regsvr32 /u msdbg2.dll
- Delete the “bad” dll from the location mentioned above
- Copy and paste the “healthy” dll
- Register the dll by using regsvr32 msdbg2.dll at the administrative command prompt
- Restart SSMS and attempt to debug
Looking at the version of the bad dll, I suspect the dll was installed by Visual Studio 2003 (v7.0), and IT probably installed SQL Server before they began the Visual Studio installation (I need to use the entire spectrum – Visual Studio 6 – 2010 and only one version of SQL Server!).
Do you know of any other scenarios that would cause this issue? Please leave a note for the benefit of all.
Until we meet next time,
Be courteous. Drive responsibly.