111

I'm running Visual Studio 2012 (version 11.0.61030.00 update 4). When debugging a local console application I get the following error when I start debugging (F5):

---------------------------
Microsoft Visual Studio
---------------------------
Error while trying to run project: Unable to start debugging.
The object invoked has disconnected from its clients.
---------------------------
OK   
---------------------------

This only happens if I leave visual studio alone without debugging for a couple minutes. If I close visual studio and re-open the error goes away (until I leave it untouched for another couple of minutes). Has anyone experienced this? I can't find any threads of other people experiencing it.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
downatone
  • 1,936
  • 2
  • 23
  • 30
  • 14
    Simply close and restart VS. That's the only solution worked for me for sometime. After getting update it disappeared. – sapatelbaps Feb 20 '14 at 14:44
  • 1
    This may or may not be related: are you running Microsoft BitLocker? – Tyler Forsythe May 15 '14 at 18:04
  • I get the same problem with VS2010 and VS2013, so it doesn't seem specific to VS2012. – Mark Ingram May 20 '14 at 09:17
  • Same VS2013 Ultimate, Update 2 -- Console app util. – TravisWhidden Jul 22 '14 at 01:16
  • 3
    [This MSDN question](http://social.msdn.microsoft.com/Forums/vstudio/en-US/be30c158-154e-4a89-84b8-019e875b5725/vs-2010-beta-2-the-operation-could-not-be-completed-occurs-with-debug-and-release-chosen?forum=vsdebug) seems to have solved a issue similar to this by renaming a folder called VS7DEBUG in `%PROGRAM_FILES%/Common Files\Microsoft Shared`. Did you try that? – Gurusharan S Oct 02 '14 at 07:49
  • Try to run without debugging (Ctrl + F5). If you are not getting any error then problem could be Visual Studio debugger msdbg2.dll might not be installed correctly. Try to repair Visual Studio, If the problem persists then manually register msdbg2.dll from command prompt. Also check if following folder exist "C:\Program Files\Common Files\Microsoft Shared\VS7Debug\" and if the problem persists then try to rename folder "VS7Debug". – Praveen Mitta Oct 06 '14 at 14:16
  • Just to add evidence. This happened to me on VS 2005 after I shutdown windows while VS was building. After restarting the machine this started happening. Restarting VS solved it. – Keith Loughnane Dec 10 '14 at 10:24
  • 2
    Can also happen w/VS 2017 - although I have never ever seen this before after using this edition for months.. but.. here I am googling... – bkwdesign Dec 20 '17 at 20:38
  • I have the same issue, but only when debugging with IE (I never receive the error with Chrome). Exact error I'm getting in VS2015 is: "Unable to start program 'https://localhost:44300/'. The object invoked has disconnected from its clients.". As others have pointed out, Restarting VS, works, but only temporarily. – Tolga Feb 24 '18 at 21:45
  • 1
    This all started for me after work forced me to install Antivirus software called Cloudstrike Falcon (WindowsSensor.exe). Who knows what its interfering with. RESTARTING VISUAL STUDIO IS NOT A SOLUTION. That's the PROBLEM. This is happening in Visual Studio 2017 (latest as of commenting), but a web search reveals that this error occurs outside of visual studio, even on the windows login screen, so it's a bigger issue. – Triynko Apr 18 '18 at 14:59

6 Answers6

36

This may be a possible answer for the problem.

Some from the answer:

  1. Check which files were changed (why and how) after update from a source control engine
  2. Review the list of extensions and plugins. Try to disable all or some of them
  3. Close Visual Studio and kill all the development processes: devenv, mspdbsrv, vcpkgsrv, msbuild, msvsmon, vshub, vstest etc
  4. Remove .suo, .ncb, .VC.db, .VC.VC.opendb files of the solution as well as .vs directory, which sometimes cause problems
  5. Remove project setting files, sort of YourProjectName.vcproj.DOMAINNAME.LOGINNAME.user or YourProjectName.csproj.user. The setting file name depends on a project kind you use
  6. Run "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /setup or "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /setup for x64 environment
Anton K
  • 4,658
  • 2
  • 47
  • 60
  • 18
    Restarting visual studio did it for me. Thanks! – Reza S Oct 24 '14 at 21:39
  • 17
    @RezaS _Restarting Visual Studio_ is just a temporary solution and just like what's the in the question (_This only happens if I leave visual studio alone without debugging for a couple minutes. If I close visual studio and re-open the error goes away (until I leave it untouched for another couple of minutes)_), It will keep bugging you again. – Kym NT Jan 12 '16 at 01:15
  • Step 4 worked for me. You should also try doing the other steps in this answer. – Kym NT Jan 12 '16 at 01:28
  • I had two instances of visual studio opened, one with a project which is integrating with a peripheral device and the other was throwing this error. I had to close both instances and starting this one again to make it work – sohaiby Jun 13 '17 at 09:01
  • A repair of the installation is the only thing that worked for me. – el_technic0 Dec 14 '17 at 10:21
  • 1
    I had to remove the hidden .vs folder at the root of my project. (This folder just holds user settings and will be recreated when the project is reloaded.) – Brian Merrell Jan 09 '18 at 20:03
  • In step 4, did you mean the `.vs` directory, not the `.vc` directory? – Jeff B Apr 07 '20 at 13:53
11

Just Close the VIsual Studio and start again the project.Its work Perfectly for me. Thanks

Debendra Dash
  • 5,334
  • 46
  • 38
  • 78
    That's not a great solution when it happens 20 times a day – codinglifestyle Mar 02 '17 at 13:45
  • @codinglifestyle this problem is just a temporary problem and restarting visual studio will solve the problem. – Debendra Dash Jun 15 '17 at 02:43
  • 19
    It's a temporary solution, not a temporary problem. – Fábio Jun 29 '17 at 13:13
  • 9
    October 2017, VS Enterprise 2017. It's still happening. This is most assuredly not a temporary problem. I'm with @Fábio. – Smoke Liberator Oct 28 '17 at 06:33
  • 1
    I understand both sides of the coin. In my case, it was indeed temporary. Not really sure, but, it seems to have occurred after I went tinkering with my build configuration (added a new build config to all projects in my .sln, then selectively reverted it out of certain .csproj files). Restart worked. – bkwdesign Dec 21 '17 at 18:04
  • 2
    So, What actually is the permanent solution for this problem guys? Were you able to resolve it? – Jamshaid K. Mar 01 '18 at 14:32
  • 2
    This is something like peoples are getting benifit from this answer and doing downvotes.Please do answer if you have any permanent solution instead of downvote this. – Debendra Dash Apr 18 '18 at 15:56
3

While restarting Visual Studio does provide a workaround, it doesn't solve the actual problem. In my case, I was working with a C# solution in VS2017 and the following resolved the issue:

  1. Close Visual Studio
  2. Delete the .vs folder that was created in the Solution's directory
  3. Re-open the Solution
eFail
  • 99
  • 5
  • Do note of course that this will result in loss of history information like the record of what files you last had opened when you re-open the Solution. – eFail Apr 25 '18 at 19:13
0

I corrupted my App.config file with NLog settings without section Handler in the top of the document. Gist is check out your config file settings either corrupted in format or not properly handled any section. once I remove corrupted config section, it did not raise the error again (VS 2017) Hope it helps!

HydTechie
  • 797
  • 10
  • 17
0

In my case I have just reinstalled Windows 10 and so the Visual Studio 2022..

My project was targeting .net 5 SDK, but I only had .net 6 SDK installed. The solution was to install earlier version of the SDK.

Alex
  • 4,607
  • 9
  • 61
  • 99
0

This is a generic error something has gone wrong and could be anything. It's worth having a look through event viewer's recent errors.

In my case I could see errors logged with a .NET Runtime source, something like this:

Description: A .NET application failed.
Application: ServiceHub.RoslynCodeAnalysisService.exe
Path: C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\ServiceHub\Hosts\ServiceHub.Host.Dotnet.x64\ServiceHub.RoslynCodeAnalysisService.exe
Message: Failed to read environment variable [DOTNET_STARTUP_HOOKS], HRESULT: 0x800700CB

That was enough to go on to solve my specific issue.

DJH
  • 2,191
  • 4
  • 28
  • 45