Reputation: 22917
When I start up Visual Studio 2010 I often get the error 'exception has been thrown by a target of invocation'
which prevents me from opening Visual Studio. A reboot of my computer makes the error go away, but a few days later it returns.
What causes this error and how can I get rid of it?
I've found a lot of questions on SO that mention this error when running their code in Visual Studio, but none when opening Visual Studio.
Upvotes: 48
Views: 60132
Reputation: 22917
It seems the problem was that my system path became too long for Windows to handle: it was over the 2048 characters limit (hat tip to this article).
Upvotes: 82
Reputation: 21
I had the same problem with Atmel Studio 7. Resolved by deleting the *.componentinfo.xml file in the same folder as the project file.
Upvotes: 0
Reputation: 3079
I had a similar problem while trying to run the "Task Runner Explorer" in VS2015, I got an error: "Exception has been thrown by the target of an invocation".
I solved it by reinstalling only the "Microsoft ASP.NET and Web Tools" patch (DotNetCore.1.0.0-VS2015Tools.Preview2.exe) from this link.
Upvotes: 3
Reputation: 1
This problem occurs due to long path in your environment variable windows supports only 2048 characters. In order to solve this problem you need to remove few environment varibale from your system from PATH.
Upvotes: 0
Reputation: 3
i had same problem but i figured out "connectionStrings" must be under "configSections" in the web.config
Upvotes: 0
Reputation: 123
To add to BioGeek's answer. You don't necessarily have to get rid of entries in your path, you can work around the character limitation by introducing more variables.
e.g.
PATH = {1800 CHARACTER LONG STRING}{500 MORE CHARACTERS}
You would add a EXTENDEDPATH variable, like so:
EXTENDEDPATH = {500 MORE CHARACTERS}
And finally you reference this variable in your PATH
PATH = {2000 CHARACTER LONG STRING};%EXTENDEDPATH%;
I'd recommend leaving at least 100-200 characters of breathing room in your path so you don't have to be babysitting the PATH environment variable every time you install something.
Upvotes: 2
Reputation: 5002
BioGeek's answer fixed my issue. In my case, the overflow of system path not only break visual studio, it also break the GUI to change system path itself.
I got error on: Control Panel > System > Advanced system settings.
The workaround is run c:\windows\system32\SystemPropertiesAdvanced.exe.
Upvotes: 3
Reputation: 56
In my case this error was due to an invalid key in the web.config file. Try to revert last changes made to the file.
Upvotes: 0
Reputation: 31
My path also seemed to affect accessing Advanced System Settings from Control Panel\system\Advanced system Settings so I was unable to edit the path.
Had to launch this from windows\system32 to display the Advanced System Settings dialog, then edit te environment variables from there.
A recent install of the MEAN stack had added a path statement for my user account. I removed this setting entirely and then VS2010 and the Advanced System Settings dialog started without problem.
Upvotes: 3
Reputation: 20390
I received this error when I installed SQL Server Express 2014 on a machine that already had 2012. I installed it with tools, which apparently broke SSMS 2012. Specifically when trying to "Edit top 200 rows" the error was thrown.
Using SSMS 2014 seems to work fine.
Upvotes: 2
Reputation: 1
System Path variable is too long. Copy current content to notepad and remove repeated entries and unwanted enteries and copy back to path variable.
Upvotes: 0
Reputation: 1222
None of these solutions solved the problem with my Visual Studio 2012, but I finally managed to fix it by installing the latest Update 4 from the Visual Studio website
Upvotes: 4
Reputation: 101
I had the same problem with Visual Studio 2012 and SQL Server Management Studio, solution was to reduce the SYSTEM PATH variable length.
Symptoms: After one instance of Visual Studio 2012 was started, any other attempt to start another or one of SQL Server Management Studio would fail. The computer reboot would allow me to start again a single instance of VS2012. Repairing the VS2012 installation didn't help.
Upvotes: 5
Reputation: 921
I had this issue with Visual Studio 2012 today. Something seemed to be gone wrong during the first setup, so it helped to delete these registry entries:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config
Visual Studio will then setup again when you start it. You can also just rename it.
Upvotes: 9