We’ve been developing .NET Core micro-services for a few months. Obviously we’ve decided to use Docker for Windows for deployment.
Don’t get me wrong I still find the experience amazing: Write code, and immediately debug your code running on Docker, it got to a point I no longer think about this amazing integration – write on Windows, deploy on Linux and it just work.
It’s been a fun but a rocky ride. From time to time we’ll get an update to Visual Studio, Docker or both. Usually didn’t break anything, but when it did – it was very frustrating for the whole team.
The last hitch happened today when I needed to show something to a fellow developer I’ve pressed F5 like I always do and as I was preparing for a quick debug session – something bad happened, I got an error dialog claiming:
The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use Microsoft.NETCoreApp 1.0.0 or newer. This may be expected if the target process did not run .NET code.
Since it worked yesterday (or at least the day before that) I’ve started thinking what could have caused this issue. I’ve found several suspects: windows updated, docker updated, Visual Studio released – in other words everything that happened to my machine could be responsible – up to and including solar winds and Bigfoot.
I’ve tried updating the project NuGet references (not sure why) and checked with the other developers – some didn’t install the latest and greatest (again not sure why). The conclusion was that all of our machines failed to debug the project we’ve been working on for the last two months.
So it might be a bug in the project – nope again! I’ve tried creating a new dummy project and found the same result.
Luckily my co-worker took the time to read Visual Studio’s output window and found the following:
And then something clicked in my head – Docker’s virtual machine was not updated for some reason. MobyLinuxVM which Docker used to run our code used an old .NET Core from our project and since it could not run the code we could not debug it.
But how can you update .NET Core on a virtual Linux machine? I still don’t have any idea. Instead what we’ve ended up doing is go into Docker settings and cause it to rebuild the virtual machine by using Reset to factory defaults…:
Once MobyLinuxVM was re-created debugging started working again.
I’m not sure if that’s the right solution but since I was unable to find any other reference to this problem let alone a solution I’ve wanted to write it down.
If you know of a better solution – please let me know.
And until then – Happy coding…