Saturday, July 24, 2010

Visual Studio 2010 won't start - '-120' is not a valid value for property 'Width'.

So today I went to open VS 2010 RTM and was surprised by an error that seemed more appropriate for a runtime error than something I'd see just opening devenv:




I spent 3 hours researching this and Google/MSDN got me nowhere. Nearly every promising lead I found refered to "devenv.exe /ResetSettings", but nothing I tried made a difference. That pretty much told me that it's not an environment setting Per se, but something more generalized to Windows.


So I fired up Process Monitor and started looking for registry activity related to 'width' and '-120'. It didn't take me long to find the registry entry: HKCU\Software\Microsoft\VisualStudio\10.0\MainWindow which contained the data: "4 4 -120 200 3". Seemed obvious enough that this was the size/location of the DevEnv MainWindow so I changed -120 to 800 (seemed a reasonable width), and fired up VS2010 again.


NO ERROR!  :)


Hope this will save someone else the headache. I think this occurred because I RDP'd into my workstation (which has 4 monitors connected, number 2 from the left being my primary) from my Droid using "Remote RDP" from www.toremote.com (not that the client has any responsibility, I just wanted to give the dev some exposure because I really like this RDP client), and did a remote restart. I think Windows didn't gracefully handle the geometry and when I tried to reopen from my physical desktop, VS2010 didn't gracefully handle the error.

11 comments :

Sirrusty said...

Thankyou and Thankyou again... exactly the same issue and you just saved me from crying quite loudly like a baby.

Ryan said...

works for me! I had to use zero instead of 800.

Nikhil said...

Wow!! it worked perfectly! I had a similar issue in VS 2012 and a value of -2. Thanks a lot.
- Nikhil

Paul said...

Thanks so much! You just saved me a lot of time trying to figure this out.

Roger Martin said...

Thanks. This helped me figure out why SQL Server Management Studio wasn't starting. I had to change -82 to 800 to get it working.

Anonymous said...

Once again. Worked perfect. Thanks!

Unknown said...

Hi people! I ran in the same trouble with VS 2013. It seems the Registers have changed since VS 2010.
Gor VS 2013, you have to modify HKEY_USERS\S-1-5-21-1181729300-1976498228-1094237608-1001\Software\Microsoft\VisualStudio\12.0\MainWindow - just make sure there's no negative value. Good luck!

Unknown said...

i am getting same error but i could not able to see the path HKCU\Software\Microsoft\VisualStudio\10.0\MainWindow. i am using visual studio 2015. Please help

Unknown said...

Just solved the same problem. The "MainWindow" section was not easy to find, so once I found VisualStudio, I did a search in that spot for the value of the error (which was -996 for me). Changed all the values to a positive number and it worked. Thanks for the help!

Anonymous said...

6 years later and this issue is still around. Just hit it in Visual Studio 2015. Here is the updated reg key to look for and change to positive values.

HKCU\Software\Microsoft\VisualStudio\14.0\MainWindow 

Jordi Carreras i Ribot said...

Works for me. Nice job! In my case, error was -320

Post a Comment

Followers