SQL Server Management Studio: Unable to read the list of previously registered servers on this system

3 Apr 2012 13:28 sql-server

I recently started having odd problems with SQL Server Management Studio on my work PC.

When I’d run it, I got the following exception, and I couldn’t browse any SQL server instances.

Microsoft.SqlServer.Management.RegisteredServers.RegisteredServerException:
Unable to read the list of previously registered servers on this system.
Re-register your servers in the 'Registered Servers' window.

---> Microsoft.SqlServer.Management.Sdk.Sfc.SfcSerializationException:
Deserialization operation on /RegisteredServersStore/ServerGroup/CentralManagementServerGroup has failed.

---> System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\Windows\TEMP\gb_pz65v.0.cs' could not be found
error CS2008: No inputs specified

To fix this exception, I deleted my %APPDATA%\Microsoft\Microsoft SQL Server folder. When I ran SQL Server Management Studio again, this exception was gone, but I had to re-register all of my servers.

Unfortunately, after that I get another exception:

Value cannot be null.
Parameter name: viewInfo (Microsoft.SqlServer.Management.SqlStudio.Explorer)

However, at the same time, Visual Studio 2010 (well, actually ReSharper) started reporting the following:

Unable to generate a temporary class (result=1). error CS2001: Source file 'C:\Windows\TEMP\oaspyffw.0.cs' could not be found error CS2008: No inputs specified

…which is almost identical to the error that I was seeing from SSMS.

It appears that my %TEMP% environment variable is set incorrectly. If, on this machine, I go to Start / Run and enter %TEMP%, I get a UAC prompt. It looks like the variable’s pointing to C:\Windows\Temp.

However, I can’t figure out where it’s set. The variable looks fine in PowerShell, but not in Command Prompt.

Light-bulb moment. Rebooting to check something.

Back from rebooting.

A couple of days ago, I “cleaned out” my %APPDATA%\Temp folder. It seems that I deleted a bit too much. Recreating the 2 subdirectory and rebooting, everything seems fine.

The clue was on the MS Connect site.

There’s another clue as to how this might have happened on the MSDN Forums, of which more here.