exception has been thrown by a target of invocation in Visual Studio 2013
Asked Answered
P

5

15

Today when I opened Visual Studio 2013 Professional Edition, I got the error exception has been thrown by a target of invocation.

Also I tried to open ILSpy to debug a dll, but it crashed. I think that it might be from the same killer. For the system I did was I installed SQL Server 2012 Professional Edition yesterday.

I checked the environment path. It is:

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Dell\Dell Data Protection\Access\Advanced\Wave\Gemalto\Access Client\v5\;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;%systemroot%\System32\WindowsPowerShell\v1.0\;C:\source\Orion\trunk\packages\NuGet.CommandLine.2.2.0\tools;%TFSPowerToolDir%;%BPADir%;%HummPATH14%;%systemroot%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\

My OS is Windows 7 64 bit.

The activitylog.xml has:

 <entry>
    <record>25</record>
    <time>2014/05/13 15:06:11.756</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [Environment Package Window Management]</description>
    <guid>{5E56B3DB-7964-4588-8D49-D3523AB7BDB9}</guid>
</entry>
<entry>
    <record>26</record>
    <time>2014/05/13 15:06:11.756</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [Environment Package Window Management]</description>
    <guid>{5E56B3DB-7964-4588-8D49-D3523AB7BDB9}</guid>
    <hr>80131534</hr>
    <errorinfo>The type initializer for 'Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService' threw an exception.</errorinfo>
</entry>
Peria answered 13/5, 2014 at 14:45 Comment(0)
P
24

Google search and get the answer. Answer

My environment was too long environment variable PATH, after shorten bellow 2048 characters the problem was solved.

Peria answered 13/5, 2014 at 18:37 Comment(2)
I also found this article helpful, as it includes a more detailed description and screenshots than the answer you linked to: dirkstrauss.com/programming/exception-thrown-target-invocationErle
Updated link: dirkstrauss.com/exception-thrown-target-invocationBehemoth
V
12
  1. Open C:\Windows\System32\SystemPropertiesAdvanced.exe
  2. Open Advanced > Environment Variables.
  3. Under System variables, find the "Path" entry.
  4. Copy the values inside.
  5. Study the contents of path and lookup some path that is long and repeat many times. the purpose is replace it with another variable.enter image description here

6, Add a new system variable entry that represent the entry found in #5.
In this case "C:\Program Files\Microsoft SQL Server" repeated 10 times , so it is my target to be tackled


%sql% for
"C:\Program Files\Microsoft SQL Server"

  1. Update the path in the path entry found in #3. such as

before:
c:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;

after
%sql%\Client SDK\ODBC\110\Tools\Binn\;

Versicolor answered 16/3, 2016 at 2:52 Comment(0)
N
1

right click on VS Icon goto->properties->Shortcut->Advance-> Check 'Run As Administrator'. Now you have done you can normally open VS.

Nicolnicola answered 14/5, 2015 at 9:51 Comment(0)
M
0

I am ran into this problem after installing Visual Studio on Windows 7. Both Visual Studio and SSMS returned the same error. My path length was under 2000 characters with no spaces between paths.

I reinstalled .Net framework and both applications started to work again.

Marche answered 18/2, 2016 at 18:38 Comment(0)
B
0

I had the same problem and my path length was well under 1000 characters. Before trying to reinstall Visual Studio I tried a simple reboot which fixed my problem.

Bret answered 17/11, 2016 at 14:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.