Debugging a .NET Core project in VS 2017 - Unable to start program, An operation is not legal in the current state
When trying to debug a .NET Core application using Visual Studio 2017, attaching the debugger suddenly started to fail with the following error message:
Unable to start program, An operation is not legal in the current state
Starting without a debugger attached worked, but attaching the debugger later on didn’t. Rebuilding my project, restarting Visual Studio, restarting my PC, all seemed to not bring a solution to the table.
This is a known issue, the solution (workaround) is to turn off JavaScript debugging on Chrome:
- Go to Tools –> Options –> Debugging –> General
- Turn off the setting for Enable JavaScript Debugging for ASP.NET (Chrome and IE)
Remark: A fix will be provided in the Visual Studio 2017 15.6 release.