locked
Visual Studio 2012 and 2010 both fail with "Exception has been thrown by the target of an invocation" RRS feed

  • Question

  • After the installation of Visual Studio 2012 Premium, both installs failed with the above mentioned popup box text: "Exception has been thrown by the target of an invocation".

    In ActivityLog.xml, the error is:

    SetSite failed for package [Environment Package Window Management]

    GUID: {5E56B3DB-7964-4588-8D49-D3523AB7BDB9}

    I did a repair install of 2012 and it worked... for a day.  Now both installs of Visual Studio are again crashing.  Given that it takes a good hour and a half to 2 hours to run the repair install, I can't do that every day.  Any other way to make this fix stick?


    Lawrence M. Smith

    Thursday, October 18, 2012 6:34 PM

Answers

  • Hello,

          I had exactly same problem. Symptoms:

     - unable start Sql Server Managment Studio 2012 and Visual Studio 2010 SP1 with above message "Exception has been thrown...." (VS2012 also installed)

    - missing icons for Windows Explorer on taskbar and icons for some system tools (Services, Event Viewer), unable to start Windows Explorer clicking to shortcut on taskbar

    - temporary solution terminating explorer.exe and re-execute it using  Task Manager working for me but only to next RDP session (connection/disconection) or installing/uninstalling any application

    - before re-executing explorer.exe was PATH variable in cmd window empty (or contains only user specific setting)

    The reason of problem in my environment was too long environment variable PATH (2312 characters), after shorten bellow 2048 characters the problem was solved.

    Hope help you,

    Eduard Koucky.

    Wednesday, December 19, 2012 2:28 PM

All replies

  • I'll add to that, I'm on Windows 7 64 bit Professional, installing Visual Studio 2012 Premium d/l from MSDN Subscription.  Visual Studio 2010 has SP1 installed.  

    This last round of "Exception has been thrown by the target of an invocation", I saw another article that recommended the re-application of VS2010 SP1 to overcome a .Net Framework patch issue.  I'm running againg, but don't know if this has resolved the issue or if I'll see this yet again.


    Lawrence M. Smith

    Thursday, October 18, 2012 9:44 PM
  • Hi Lawrence Smith,

    Thank for your post.

    The log ActivityLog.xml was used to log issues when your are running Visual Studio.

    I'm a little confused about your issue. To help you, we need to reproduce it first.

    Does your installation crashed with the message you mentioned? 

    Or you may mean VS installed without reporting any error but when you tried to open it, this message show up?

    What do you mean of "both installs failed"?

    I recommend you gather logs for me to analyze, here is the tool: http://aka.ms/vscollect

    You will find vslogs.cab from %temp% folder after running the tool. Please upload the file to https://skydrive.live.com/  and share the link with me.

    It seems sometimes you will meet this error when programming. If you meet this when building some projects, please let us know your project detail. I referred to http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/3e0840b2-e7b2-4ac5-9a7b-f88708206f18/

    Regards,



    Barry Wang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, October 19, 2012 6:50 AM
  • I believe I have the same issue as the OP.  I am also running Windows 7 Professional x64.  I will try to provide as much information as possible...

    I have had VS2010 Professional installed and working over a year on this computer without any issues. 
    I did not even know there was an SP1 for it and never had it installed.

    I just installed VS2012 Professional yesterday and imported my settings from VS2010 Professional.  Everything was great yesterday. 
    I copied my projects over to a new folder in My Documents and was able to open and build them in 2012 without issues. 
    I was able to still open the projects in 2010 without issues.

    Today when I tried to load up 2012 I get an error message during startup of the program: Exception has been thrown by the target of an invocation. 
    The message pops up in a standard error message box with a title of Microsoft Visual Studio. 

    So I figured I would use 2010 instead since it is still installed and I get the exact same error message in the exact same error message box.

    I did some research and could not find any fixes for this error regarding 2012 and 2010 at the same time. 
    I tried uninstalling and reinstalling both and I get the same results.  I found a post on a forum that suggested 2010 SP1 would solve the issue for 2010. 
    I installed 2010 SP1 without issue.  However, I still have the same issue.

    After reading this post I check my ActivityLog.xml for 2012 and I get the same error as the OP: SetSite failed for package [Environment Package Window Management]. 
    I also have "The type initializer for 'Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService' threw an exception."

    Oddly enough there is no ActivityLog.xml in my 2010 folder: C:\Users\<User>\AppData\Roaming\Microsoft\VisualStudio\10.0.

    As suggested, I have run the VSCollect program and uploaded the resulting vslogs.cab to my skydrive.
    Here is a link to the file: https:// skydrive.live.com/ redir?resid=1CFAD30847F91876!125&authkey=!ALigo-Yhykrlu3E. 
    (Sorry about the spaces, it wont let me post links.)

    Hopefully this will be fixed quickly as I am at a full stop until this gets resolved.  I am just glad I decided to test run 2012 at home before running it at work.  :)

    Monday, October 22, 2012 3:19 AM
  • I wanted to reply back to clarify my issue. It is as jjarmis reported.

    I had VS2010 installed for 2 years running fine.

    I installed VS2012 a week ago today.  Since that time when I attempt to run either VS2010 OR VS2012, both will fail with the message box "Exception has been thrown by the target of an invocation."
    I've also since discovered that Sql Server Management Studio 2012 is likewise affected, on trying to execute it I get the same error message box.

    Since my last post, I've found that if I reboot my computer, for a limited amount of time both VS2010 and VS2012 can be run successfully. I can have multiple instances of both running concurrently.
    Also if I terminate the Explorer.exe process, and re-execute it using Task Manager, I also can re-execute Visual Studio and SSMS.

    At some point later during the day, the stated failure will reappear.  Any instances of VS that are already running will remain so, but I will be unable to start any new instances of either Visual Studio.

    Here is the skydrive link to the vslogs.cab I collected for you.

    https://skydrive.live.com/redir?resid=3F1D7B8D9FD45A20!120&authkey=!ANikfhAyk6X6DsU

    Thanks for any help you can lend!


    Lawrence M. Smith

    Monday, October 22, 2012 5:04 PM
  • Try terminating your Explorer.exe process, and re-executing it using Task Manager, and see if that gets you going again.

    -Larry Smith


    Lawrence M. Smith


    **Note, I wouldn't consider this a fix, just a temporary workaround.
    • Edited by Lawrence Smith Monday, October 22, 2012 5:44 PM Additional Info
    Monday, October 22, 2012 5:05 PM
  • At least, I know there is some known issue between vs2010 and vs2012. Suggest you resinstall vs2010 + sp1, and then install vs2012

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Regards,
    Jacky Wu
    Microsoft Online Community Support

    Thursday, October 25, 2012 6:51 AM
  • I just started getting this crash issue today with VS 2012

    I'm running Win 7 Pro 64 bit. Using VS 2012 Pro. I also have VS 2010 and 2008 installed.

    This happened for me immediately after installing the 'Productivity Power Tools' add-in for VS.

    Just like the OP I was able to do a 2 hour repair and it seemed to be fine, but just now it has happened for the second time. I'll try uninstalling the power tools addin when i do my next repair and we'll see if that fixes my issue...

     

    • Proposed as answer by 刻录Banned Saturday, November 10, 2012 7:39 AM
    • Unproposed as answer by 刻录Banned Saturday, November 10, 2012 7:40 AM
    Saturday, November 10, 2012 3:40 AM
  • I too am experiencing the problem.  VS 2012 won't even allow me to uninstall, it too fails the same way.  Please advise.
    Wednesday, December 12, 2012 1:56 PM
  • Hi Barry,

    it seems I have a similar problem.

    I had a VS2012 Ultimate RC and VS 2010 Sp1 installed. I decided to upgrade the 2012 to RTM, but we only have Premium version available so I had to uninstall the RC first. I did that and then installed the Premium, restarted, finished installation. I ran it, imported settings, opened a web project, realized I need extensions, installed web essentials and rockmargin, restarted visual studio.

    Then I changed settings on the productivity tools (which I didn't install manually but I had them in the previous RC installation), shut down VS and when I started it again I got the same error in the ActivityLog (and messagebox exception has been thrown by the target of an invocation). Now my VS 2010 won't start either. Neither the setup of 2012

    Here are my logs from the tool you posted: https://skydrive.live.com/redir?resid=AC7F00023A126FAA!5885&authkey=!AFxVxWgzsDCUuJw

    Thanks for any workarounds,

    Jan

    Thursday, December 13, 2012 5:41 PM
  • I have the same issue today.  Launch VS2012 and it crashes on startup with the message described.  I'm wondering if this has anything to do with today's update package from Microsoft.  This crash occurred just after the following updates were installed today:

    KB2598242, KB2779562, KB2781514 (VS2012), KB2687508, GB2779030, KB2687501, KB890830, KB2753842, KB2758857, KB2770660, KB2761465, KB2687510, KB982726, KB2760410

    I'm going to try doing a System Restore to yesterday and see if that fixes the problem for me.

    -- S. Loughin


    Update at 3:16 PM EST - I used System Recovery to restore my system to yesterday (before all those updates listed above) and VS2012 now launches for me and loads projects.  So I have a strong suspicion that at least my problem was caused by KB2781514.  -- SL.
    • Edited by sloughin Thursday, December 13, 2012 8:19 PM
    • Proposed as answer by Gfw Sunday, December 16, 2012 6:16 PM
    Thursday, December 13, 2012 7:51 PM
  • For the past 2 weeks, this workaround of restarting the explorer process has also stopped working.  Now if I want to open a dev environment of any kind, I have to reboot. 

    Microsoft's silence on this issue is completely frustrating.  I'm going to attempt to uninstall/reinstall all developers tools.  Failing that, I'll have to re-image my machine.  I find this extreme, but I have to regain my productivity.

    Is anyone from Microsoft listening?

    Thursday, December 13, 2012 11:37 PM
  • Dear Barry,

    Any chance anyone from Microsoft can take another look at this problem please?

    -Lawrence M. Smith

    Thursday, December 13, 2012 11:39 PM
  • I am having the same issue.

    I had automatic updates on and received the KB2781514 (VS2012) update - lots of problems, but totally lost my JavaScript debugger. I removed that update, did a repair and some of my issues went away.

    Tomorrow am I'll have more time to play - especially with the JavaScript debugger.

    Anyone out that from Microsoft that know of a real fix?

      Update... after I removed  KB2781514  everything returned to normal and the JavaScript debugger worked as before. Maybe something wrong with KB2781514.

    Fyi... I am running Win8 Pro 64 bit and VS2012 Pro 

     

    • Edited by Gfw Monday, December 17, 2012 1:56 PM Updated response
    Sunday, December 16, 2012 6:20 PM
  • Hello,

          I had exactly same problem. Symptoms:

     - unable start Sql Server Managment Studio 2012 and Visual Studio 2010 SP1 with above message "Exception has been thrown...." (VS2012 also installed)

    - missing icons for Windows Explorer on taskbar and icons for some system tools (Services, Event Viewer), unable to start Windows Explorer clicking to shortcut on taskbar

    - temporary solution terminating explorer.exe and re-execute it using  Task Manager working for me but only to next RDP session (connection/disconection) or installing/uninstalling any application

    - before re-executing explorer.exe was PATH variable in cmd window empty (or contains only user specific setting)

    The reason of problem in my environment was too long environment variable PATH (2312 characters), after shorten bellow 2048 characters the problem was solved.

    Hope help you,

    Eduard Koucky.

    Wednesday, December 19, 2012 2:28 PM
  • Eduard,

    I can confirm, I've had problems with the path variable getting emptied out when I run a command window lately. Like you, I had a very large path statement from numerous installs.  After trimming it down to bring it to under 2048, it seems to be working!  

    So far, I've been able to open development environments at will all day.  My command windows retain their path as well.  My guess is, if the path variable gets dumped at some time after reboot, my dev environment can't load some Visual Studio add-on and crashes.  If my success continues on into tomorrow, I'll gladly mark this as the solution.

    Something as simple as the length of the path variable.....     I wonder then, why after a fresh boot it works at all?  Why work for an hour or so and THEN fail.  Why restarting Explorer.Exe works for a few weeks and THEN doesn't work around the problem any more?  I'll gladly give up the answers to those questions if this fix holds.  

    Thanks so much for your recommendation!

    -L. Smith

     * 12/23/2012 *  Eduard's solution worked for me.  No further issues since i cleaned up my path environment variable.  Thanks again, you saved me from an expensive and possibly pointless reimage/reinstall of my whole workstation.
    • Proposed as answer by vscompany Saturday, December 22, 2012 7:48 PM
    • Edited by Lawrence M. Smith Sunday, December 23, 2012 9:14 PM correction
    Wednesday, December 19, 2012 9:09 PM
  • Lawrence,

    Thank you very much. Your solution is absolutely right.

    Good luck!

    Saturday, December 22, 2012 7:49 PM
  • Glad to see you have found the empty path variable issue. Does it work in this week? In addition, can you let me know what command window you have run to make the path variable. Then, I can try to reproduce the issue locally and debug it.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Regards,
    Jacky Wu
    Microsoft Online Community Support

    Monday, December 24, 2012 8:47 AM
  • Hi Jacky,

    I have installed Web Developer Express 2010 on a Windows Xp machine and have the same problem right after a successful registration. Unfortunately I don't find any log files from Visual Studio. Any idea what I can do ?

    Regards,

    WonderWhyNot

    • Proposed as answer by Codester45 Sunday, January 6, 2013 5:19 PM
    • Unproposed as answer by Codester45 Sunday, January 6, 2013 5:19 PM
    Saturday, December 29, 2012 12:08 AM
  • I think I might know the who as to "the add-in" that is causing this issue. I am having the same issue as discussed, the target of invocation exception on start-up. of visual studio" After reading thought this entire thread, the environment variable going missing and working after a reboot struck a bell.  

    So the Oracle Plug-in is installed on my machine, and actually after any oracle install, oracle hosed all my environment variables, even ipconfig was not found at the command prompt until a reboot then it went back to normal. After installed vs2012 prem, I started have the same problems as everyone else in this thread. When opening visual studio 2010, the environment variables seem to go missing specificly the windows system one. I believe that Oracle still thinks that the system path is the same as it was during the WinXp days and they havent updated there install to reflect the difference or OS detect. After uninstalling oracle-plug in the problem went away completely. 

    if the ODAC or any other part of the Oracle for visual studio package is on the machine uninstall it, reboot and the problem should permanently go away.  

    I have moved any Oracle-VS integration to a special local Virtual machine and only installed one flavor of visual studio. Oracle doesn't support vs 2012 yet, and it really doesn't play well on newer OS's than xp.

    Cheers,
    Hope this helps

    Michael Bordogna 
    Senior Solutions Architect
    Web Essentials Consulting, inc

    http://www.webessconsult.com

    • Proposed as answer by Codester45 Sunday, January 6, 2013 5:22 PM
    Sunday, January 6, 2013 5:20 PM
  • Hi Michael,

    When this failure appeared for me, I didn't have any Oracle support installed.  I believe this is an OS problem with Windows, not sure if limited to Windows 7 64bit or not.  When the path is big enough, some point after a reboot it dumps the system env variable.

    For whatever reason I cannot seem to mark Eduard K's response as answer, but I believe he has the correct answer.

    -LS

    Sunday, January 6, 2013 7:42 PM
  • Yes Eduard K's response worked for me.
    Friday, January 11, 2013 9:05 PM
  • The "Path" variable is limited to 2048 characters which has has been covered in http://support.microsoft.com/kb/832978/en-us, and this setting is carried to Win7 as well.  While, I can't figure out why the varible get into empty when it is longer than 2048.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Regards,
    Jacky Wu
    Microsoft Online Community Support

    • Proposed as answer by anrom Saturday, May 2, 2015 10:06 PM
    Monday, January 14, 2013 6:07 AM
  • Same issue here, but just reducing the PATH var didn't solve it for me.  I installed VS2010 SP1, then VS2012, then VSTFS Power Tools pack, then hit this issue.  I tried uninstalling the VSTFS Power Tools and reducing the PATH length and still got the error.  What fixed it for me was running:

    devenv /resetuserdata

    As per this blog post.  After that VS2012 loaded fine, I was able to re-install the VSTFS Power Tools, and appear to be back in shape.

    Wednesday, January 16, 2013 8:37 PM
  • That worked for me as well. Thanks a LOT!
    • Proposed as answer by pjs.net Friday, March 1, 2013 12:38 AM
    Friday, March 1, 2013 12:37 AM
  • Hello,

    For those of us who are not literate in the back end functionality of these programs, can you please explain this solution more clearly?

    Simply saying Reduce the length of the path variable is not enough. I think you are talking about a registry value, but I am not sure, and have no clue how to find it.

    While I have been developing code for 14 years, I write code, I don't fool around with registries and such, and mostly the tools work very well. Yesterday and today are exceptions, as both VS 2012 and SQL 2012 decided to throw this exception when I tried to start them.

    Regardless, PLease explain this PATH variable solution clearly. For all the MS Moderator types, PLease take note of this complaint and EXPLAIN all solutions clearly, as very seldom do I ever find concise, precise instructions here. I generally, like today, have to take a small nugget and do massive further research to figure out what should be really simple, if those of you who understand it would only provide clear answers.

    Thanks!

    Tuesday, April 30, 2013 4:05 PM
  • @Tex1986,

    If you've been programming for 14 years, you've likely run into the path variable before.  Think back to the DOS days, when to run a program without specifying it's full path, you would add the path to your program to the system's PATH variable.   Thereafter you could evoke your program no matter what sub-directory your command prompt was currently pointing to.  Well, that old setting is still in use today. When it gets broken by being too long, a lot of things begin to go wrong with the system.

    To find the path variable:  http://www.itechtalk.com/thread3595.html

    The PATH variable is in the second box, with the system environment variables .  Copy the contents of the path setting over to any text editor, and you'll probably see that the line length is greater than 2048.   You'll have to exercise some judgement on what to remove from your path var setup, but get the length under 2048 by removing some entries, and paste it back over to update your path variable.  Then reboot your system.  I've had no further trouble with my install since I did this.

    -Lawrence Smith

    Wednesday, May 1, 2013 3:02 PM
  • Thanks Eduard -

    Worked for me!

    Wednesday, May 1, 2013 4:46 PM
  • @Lawrence,

    Thanks for the explanation and your quick Response. I followed this and found my PATH var to be 1300 long. I shortened it to under 1000, but no luck. I have uninstalled and reinstalled both 2012 programs to no avail.

    The error I get with vs2012 from event viewer says it cannot access:

    Windows\assembly\NativeImages_v4.0.30319_32\Microsoft.Vf4cf6d96#\4eae0402bcb0aeb92c4768a2c9a5086e\Microsoft.VisualStudio.Shell.Interop.8.0.ni.dll

    While there is a version".8.0" in the GAC, there is not an ".ni" version. If needed, I would have thought VS would install it.

    I also found shell interop dlls in the microsoft.NET / Gac-msil folder, but the 8.0 version is missing. Could VS and SQL be looking in that folder rather than the windows assembly folder?

    A separate error defines the faulting module as : clr.dll, version: 4.0.30319.18034

    I saw at one point the message that the assembly didn't have an entry point. The dll does exist and the date on it matches the last installation I performed.

    I'm not sure where to go from here.

    Any ideas?

    Wednesday, May 1, 2013 5:46 PM
  • I had the same problem in a Win8 x64 VM after the following 4 Windows Updates were installed.

    I removed all 4 of them and it went back to normal... 

    KB2805227

    KB2805222

    KB2805966

    KB2820330


    Thursday, June 6, 2013 2:53 PM
  • I just experienced this problem after installing Windows Azure Tools for Visual Studio 2012.  I tried all of the solutions above (and yes my path had exceeded 2048 characters), but even after resetting my user data as one poster suggested, and rebooting, I still could not launch VS 2012.

    I went into "Uninstall Programs" and did a "Repair" install on "Windows Azure Tools for Visual Studio 2012", and I was once again able to run Visual Studio.


    Tuesday, August 13, 2013 3:28 AM
  • I also received this error, and my path was not long.  I uninstalled and reinstalled the Power Tools, rebooted, then it went away.
    Monday, August 19, 2013 1:00 PM
  • I had the same problem and shortening the path variable solved it. Thanks for the post. Saved a lot of headaches.
    Monday, September 2, 2013 8:23 PM
  • thanks Lawrence. It worked for me.
    Tuesday, September 10, 2013 9:35 PM
  • THIS IS THE SOLUTION. Thaks!
    Friday, September 27, 2013 3:51 PM
  • Resetting the PATH environment to below 2048 characters solved my problem immediately. The path was full of tool installation paths each with their own /Program Files (x86) and /Program Files.

    Thank you.

    Saturday, October 19, 2013 5:55 PM
  • Tank you!

    it's my path had exceeded 2048 characters and his o problem.

    Sunday, October 20, 2013 8:24 PM
  • Global PATH variable was too long on my 64-bit Windows 7 laptop.  Too much "cruft" from too many years.  Cleanout was long overdue.  Instantly fix the problem.

    Wednesday, October 23, 2013 1:30 AM
  • Also worked for me.  I had performed a few maintenances and those (google apps ug) kept adding characters to my Path and was 2011 chars long.  I cleaned it and worked.

    I have tons of things on my path so I had to devise a method that could work for some people who are near the 2000 mark:

    Created 4 variables:

    A_PF           C:\Program Files\
    A_PF86         C:\Program Files (x86)\
    A_PFCF         C:\Program Files\Common Files\
    A_PF86CF       C:\Program Files (x86)\Common Files\

    And then simply replaced those strings on my Path string, for example a part of my path below:

    %A_PF86%AMD APP\bin\x86_64 ; %A_PF86%AMD APP\bin\x86 ; %A_PF86%Intel\iCLS Client\ ; %A_PF%Intel\iCLS Client\ ; %A_PF86%Windows Live\Shared  ; %A_PF86CF%Microsoft Shared\Windows Live ; %A_PFCF%Microsoft Shared\Windows Live ; %A_PF86%CyberLink\Power2Go\ ; %SystemRoot%\System32\Wbem...etc etc etc

    Hope this helps some who can't help but have a ton of things there...

    EDIT:   Notice that all my "meta" variables' names in the example above begin with A_ the reason for that is that after a lot of trial and error I discovered that the system (shell, explorer, whoever) processes environment variables alphabetically, so if I wanted to be able to reuse them, I had to force the system to process them first.  

    [Also, it processes all system defined variables and then moves to process user defined variables, as one would expect.]

    For example, if I defined the variable PATH as containing %quitealongvariablename% it would not work, because PATH was processed before quitealongvariablename. So, if you use the trick above (it is a trick indeed and I hope it doesn't break in the future), remember to name your variables so they are processed before anything else.

    • Edited by Andrés S Thursday, February 6, 2014 11:43 PM Additional information regarding variable names.
    Wednesday, November 6, 2013 3:48 PM
  • Perfect addendum to the discovery of the long path.  A way to shorten it without loosing any path entries.  Thanks so much for posting this.

    Lawrence M. Smith

    Wednesday, November 6, 2013 4:36 PM
  • I had a similar issue after installing the AMD APP SDK.  I had something like 2025 characters in my PATH before installation and Visual Studio 2012 worked fine. After the install (4 new additions into the path of about 20 characters each), Visual Studio 2012 would crash.  Cleaned path back down to 2022 characters and VS2012 works fine now. 

    The developer life is painful with the 2048 character PATH limit.

    Friday, November 15, 2013 1:33 AM
  • I just spent all day creating a development PC with Visual Studio 2008 -> 2012, Sql Server Management Studio and the rest and then boom, I get this error, nothing works, not even notepad!

    I didn't want to remove anything from the path variable, so cleaning it with the 4 variables method above was a perfect solution. Thank you. 

    Thursday, November 21, 2013 11:45 AM
  • This worked!  I really didn't want to remove anything but found duplicate entries from Intel.

    I also went ahead and created some new System Variables as they are ridiculously long...

    IMEC "C:\PROGRAM FILES\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS"

    x86_IMEC "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components"

    PF "C:\Program Files"

    x86_PF "C:\Program Files (x86)"

    This made me wonder; Can System Variables reference other System Variables?  I assume from you examples that you can't.

    Thanks All!

    Thursday, February 6, 2014 10:07 PM
  • hmmm system vars referencing system vars work but they are processed *alphabetically* which is why in my example above all vars began with A_<whatever>. I think I didn't explicitly state so in the entry above, I'm going to edit the entry to note that.... Its quite the hack in my opinion, but has worked for me for ages :D

    Thursday, February 6, 2014 11:37 PM
  • Makes perfect sense.  Here's what I ended up with...

    A1_PF       C:\Program Files

    A1_PFx     C:\Program FIles (x86)

    A2_IMEC   %A1_PF%\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS

    A2_IMECx %A1_PFx%\Intel\Intel(R) Management Engine Components

    A2_SQL    %A1_PF%\MICROSOFT SQL SERVER

    A2_SQLx  %A1_PFx%\MICROSOFT SQL SERVER

    Friday, February 7, 2014 8:36 PM
  • Made my day. Thanks

    The HARDER I work, the LUCKIER I get!

    Monday, March 10, 2014 5:38 AM
  • This not a good answer. Someone at Microsoft needs to provide a better answer. This is 2014 and the problem still exists! Currently I am having to restart my computer and

    RUN devenv.exe /resetuserdata

    before I can open 2012 or 2010.

    Thursday, April 3, 2014 7:33 PM
  • Worked perfectly! Thanks! 
    Tuesday, April 8, 2014 8:48 PM
  • I get the issue in 2013. I can open 1 or 2 VS environments then every time I open a new one I get "Exception has been thrown by the target of invocation" 

    Only way to fix it is restart the machine.

    Monday, May 19, 2014 10:46 PM
  • This worked for me--thanks!
    Tuesday, May 27, 2014 11:46 PM
  • In my case, I have VS2010 SP1 installed before I installed the SQL Sever 2012 x64 that has caused this invocation exception.  I reapplied (rerun the installation of) VS2010 SP1 then it solved the problem.
    Tuesday, July 22, 2014 3:32 PM
  • Hi Matthew N.Reid,

    How to resetting the PATH environment to below 2048 characters.

    I'm using Win7 64 bit. Both Visual Studio(2010&2012) are under C:\Program Files (x86)

    I can't run Visual Studio 2010 & 2012, get error "Exception has been thrown by the target of an invocation" in start.

    Thanks.

    Wednesday, August 13, 2014 3:50 AM
  • That looks exactly like that

    http://www.dirkstrauss.com/programming/exception-thrown-target-invocation#.VGGK3vmUeAo

    Tuesday, November 11, 2014 4:07 AM
  • Thanks, Eduard. Reducing the PATH to 2048 fixed it for me

    Cheers,

    Roman

    Wednesday, January 28, 2015 1:26 AM
  • Thank you Eduard and Lawrence. I had the same issue and it resolved after shortening the path.
    Tuesday, March 10, 2015 5:42 PM
  • This is another time Microsoft do great job screw up whole system. Check if you switch user in your machine? Make log off than it will work.
    Wednesday, April 1, 2015 8:51 AM
  • My computer has behaved really wired these days without find a way to fix it. I even thought I was hacked or something but never thought this was the issue. You post save everything. In addition Andrés S's way of shrinking is smart too. Thanks guys. 
    • Proposed as answer by Kervin Gomez Monday, May 25, 2015 5:36 PM
    • Unproposed as answer by Kervin Gomez Monday, May 25, 2015 5:36 PM
    Monday, April 20, 2015 9:16 PM
  • Hi

    I think there are two scenarios here. 
    1. PATH longer than 2048
    2. PATH too short

    In my case shortening PATH to less than 2048 does not apply because my PATH is 1638 chars long.

    If I execute Visual Studio as Administrator there is no "Exception has been thrown by the target of an invocation". If I execute Visual Studio with my user the message shows up.

    So whats different between them? Administrator works, my user don't (I have Administrator privileges). I checked system properties, environment variable PATH; User Variables and System Variables were the same, too short (PATH=c:\windows), not including any of the Visual Studio paths. Then I checked PATH value in command prompts, one as Administrator and the other with my session, to my surprise the Admin window showed PATH 1638 chars long with all the Visual Studio paths and my user's window showed the short value . After copying the admin PATH value to my user PATH the problem was solved.

    Hope this helps you too.

    Microsoft: How do PATH changes unexpectedly from 1638 chars to less than 20 on my account? Why reboot fixes this and changes again back to less than 20?

    Monday, May 25, 2015 6:00 PM
  • 3 yo answer but still solves the issue. Thanks a lot
    Saturday, June 6, 2015 10:24 AM
  • Works perfectly for me. 
    Monday, July 4, 2016 5:52 AM
  • 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:

    https://visualstudiogallery.msdn.microsoft.com/c94a02e9-f2e9-4bad-a952-a63a967e3935?SRC=VSIDE

    Sunday, July 31, 2016 6:56 AM