« It has been that kind of a day | Main | Fixing TeamCity errors in the Visual Studio experimental instance »
August 18, 2010
Fixing the Server Explorer “The given key was not present in the dictionary” error
One of Visual Studio’s most cryptic error messages is Server Explorer’s infamous “the given key was not present in the dictionary.” This typically means that you’ve installed a custom data provider, created a Server Explorer connection using that provider, and then uninstalled the provider without deleting the Server Explorer entry. This pretty much kills Server Explorer: from now on, any time you try to add or remove a connection, it barfs up the useless error. This means you can’t even remove the dud connection.
The top Google hits for this issue recommend such brilliant solutions as creating a new user account and formatting your hard drive and reinstalling Windows. Fortunately, you don’t have to go to such extreme lengths.
If you can guess what provider you might have installed and uninstalled, then you can reinstall that provider, delete all associated connections, then uninstall the provider once and for all.
If you can’t identify the provider, or can’t reinstall it, then you can go under the hood to remove the invalid connection. Here’s how.
First, close all instances of Visual Studio.
Now, go into your user AppData directory (e.g. C:\Users\Alice\AppData) – note this may not be shown in Windows Explorer if you have “Show hidden files and folders” turned off – and drill down into Roaming > Microsoft > Visual Studio > 10.0 > ServerExplorer. You’ll find a file in there called DefaultView.SEView. This bad boy is where the connections are stored.
This is a plain XML file, so in theory, you can locate the dud connection by its Label and just remove the containing DataViewNode XML element. In practice, I didn’t have much luck with this – the file stores blobs against connections by index, so deleting individual items can throw those indexes off. But if you’ve got a lot of connections defined and you don’t want to have to recreate them, it’s probably worth giving this a try in case you get luckier than I did.
Otherwise, just delete the DefaultView.SEView file.
Then restart Visual Studio and party on.
Hat tip to Jason Short at VistaDB.
August 18, 2010 in Software | Permalink
TrackBack
TrackBack URL for this entry:
https://www.typepad.com/services/trackback/6a00d8341c5c9b53ef0133f3229cb3970b
Listed below are links to weblogs that reference Fixing the Server Explorer “The given key was not present in the dictionary” error:
Comments
Thank's a lot for this tip - I was preparing a demo and run into that frustrating error and got it fixed in seconds (you're the man;).
Peter
Posted by: Peter M. at Sep 18, 2010 1:00:58 AM
Thank !
Posted by: Mike at Feb 11, 2011 12:11:43 AM
Thank !
Posted by: Mike at Feb 11, 2011 12:11:43 AM
Thankx for the post...It did fix thew problem....
Posted by: akeel at Feb 20, 2011 7:15:36 AM
Thankx for the post...It did fix thew problem....
Posted by: akeel at Feb 20, 2011 7:15:37 AM
thanks a lot,it works!
Posted by: Rex at Mar 16, 2011 6:42:20 PM
Thanks man. It worked for me
Posted by: Prasad at Jul 1, 2011 4:22:36 AM
mny thx. You're great!
Posted by: judopa at Sep 4, 2011 5:43:32 AM
Cool you are the king...
Posted by: shiv at Sep 30, 2011 3:27:12 AM
thanks
Posted by: dzess at Nov 7, 2011 9:15:35 PM
thanks
Posted by: dzess at Nov 7, 2011 9:15:36 PM
Thank you soooooo much!!!
Posted by: pregh at Mar 13, 2012 6:48:37 AM
thanks
Posted by: lili at Jun 11, 2012 3:15:22 PM
Thanks much that was driving me insane
Posted by: rpg at Feb 6, 2013 6:53:26 AM
Thank you so much!
Posted by: Serkan YILMAZ at Jul 1, 2014 8:09:03 AM