Reputation: 7669
After fresh installation of Visual Studio 2017 I tried to run .NET Core Web project and when trying to run it on Chrome I am getting this error:
Unable to start program, An operation is not legal in the current state
Upvotes: 405
Views: 155846
Reputation: 21719
Today I got this error, and I just did a small workaround which was too simple.
You will not get the error again and if the debugger doesn't hit, refresh the browser again.
Update (12-Dec-2018):
I just tested this bug in Visual Studio 2019 preview, it seems like the bug is fixed now.
Upvotes: 212
Reputation: 2703
Incase you are not able to resolve the issue in any other way, then try this(it worked for me!):
Keep this below code into your web config file then rename value="yourwebformname.aspx"
<system.webServer>
<defaultDocument>
<files>
<add value="insertion.aspx" />
</files>
</defaultDocument>
<directoryBrowse enabled="false" />
</system.webServer>
else Try:
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
Upvotes: 0
Reputation: 53
From the Chrome browser, go to: Settings>Advanced>System
and disable "Continue running background apps when Google Chrome is closed".
IMPORTANT! The option above must be set for the correct Chrome User Profile!
Visual Studio has its own Chrome User Profile, preferences you set when using your "normal" Chrome browser wont have any affect on the Chrome browser launched from VS (with JS debugging enabled).
Whenever you stop debugging, you must close the Chrome instance initiated by VS or the error will return the next time you run the project. If there are other Chrome instances, you can leave these open.
To make sure Chrome is using the correct User Profile, go to chrome://version/ by typing it in the url bar, then look at the value for Profile Path. On Windows, the correct value should look something like this:
"C:\Users\[UserName]\AppData\Local\Microsoft\VisualStudio\15.*\WebTools\ChromeUserData_*\Default"
If Chrome is using the browser default or if you're logged in to Chrome with an account, it will look something like this:
"C:\Users\[UserName]\AppData\Local\Google\Chrome\User Data\[ProfileName] OR Default"
Bonus note. If you use Chrome Extensions when debugging, these has to be installed when the VS Profile is active.
Upvotes: 0
Reputation: 111
I was able to solve this issue in Chrome by turning off the Calendly Chrome extension which I had recently installed. May not be Calendly specific so I would recommend turning off any newly installed Chrome extensions. Below are the steps I took:
Upvotes: 0
Reputation: 6486
What fixes it for me is to look in the task bar for open chrome apps, right click and close them.
Upvotes: 2
Reputation: 634
This error message appeared for me when I tried to debug two solutions at the same time as I wanted to visually compare the differences. Unchecking the Enable JavaScript Debugging for ASP.NET (Chrome and IE) option worked, but I am still confused why I could not debug more than one solution at a time. Since it is a known issue, maybe this will be address in an update from Visual Studio. Here is to hoping ....
Upvotes: 1
Reputation: 2685
Either switch your browser in VS2017. Or open up a command prompt as administrator and do a tskill chrome about 10 times to make sure the app fully dies. Then try again. Sometimes it gets stuck on another process and even it needs to be restarted.
Upvotes: 1
Reputation: 428
3 options
Upvotes: 9
Reputation: 2106
I use chrome's build in developer console tools to debug javascript so the answer marked solution works great for me.
This is the weird error message i was getting from VS Community 2017 when trying to debug asp.net app:
"An error occurred that usually indicates a corrupt installation (code 0x80040154). If the problem persists, repair your Visual Studio installation via 'Add or Remove Programs' in Control Panel." and it's fixed now.
Upvotes: 1
Reputation: 634
Another solution you can try that worked for me when I received this error is to clean the solution, then do a rebuild. As the other solutions did not help me, I thought this might help someone else in the same boat.
Upvotes: -1
Reputation: 883
For me the issue was signing into my Google account on the debug Chrome window. This had been working fine for me until I signed in. Once I signed out of that instance of Chrome AND choose to delete all of my settings via the checkbox, the debugger worked fine again.
My non-debugging instance of Chrome was still signed into Google and unaffected. The main issue is that my lovely plugins are gone from the debug version, but at least I can step through client code again.
Upvotes: 3
Reputation: 21
I just recently had this error. What fixed it for me was to close a chrome window that was running the inspector. I have it pop out its own window whenever I inspect a web page. Did not need to disable or change anything on visual studio.
Upvotes: 2
Reputation: 21
I tried the answer by Sibeesh Venu, but that didn't work for me. I believe that if I had killed all chrome processes, it would have worked. I completed some other testing and found that turning off "Continue where you left off" in Chrome settings ensured that this did not occur again for me.
Upvotes: 2
Reputation: 1832
The other answers in my case did not work. I had to restart windows before I could debug the application again.
Upvotes: 1
Reputation: 623
I had the same problem after the most recent VS 2017 update (released March 14, 2017: build 26228.09). My program would debug fine in IE but would bomb out in Chrome. Killing all instances of Chrome within the Windows command line fixed the problem for me.
taskkill /im chrome.exe /f
I was then able to debug in Chrome.
Upvotes: 33
Reputation: 8686
For me, the solution (workaround) is to turn off JavaScript debugging on Chrome, which I believe is a new feature introduced in VS 2017.
Go to Tools > Options > Debugging > General and turn off the setting for Enable JavaScript Debugging for ASP.NET (Chrome and IE).
This is a known issue already, and seems to have an investigation underway.
Full information about JS debugging in VS 2017 here: https://blogs.msdn.microsoft.com/webdev/2016/11/21/client-side-debugging-of-asp-net-projects-in-google-chrome/
Upvotes: 762
Reputation: 11515
I just closed all open chrome instances, stopped my project and then start it again. that fixed the problem for me.
Upvotes: 3
Reputation: 51
I think that this happens when javascript debugging is enabled in visual studio and at the same time the chrome developer tools debugger is enabled. The problem arises because two different debuggers trying to debug the same process.
Upvotes: 5
Reputation: 5302
I found a workaround to this which worked for me.
With Chrome selected as your browser, click the Debug
menu and select Attach to Process...
.
In the subsequent dialog, select Chrome.exe
in the list and click the Select
button for Attach to:
. Tick the Native
box, then Attach
(or just double-click Chrome.exe
):
This starts the project running without launching the browser. Stop and restart in Chrome and the error is gone.
Of course, another potential solution is to use a different browser but I like debugging in Chrome. :-)
Upvotes: 7