Search code examples
visual-studiodockerasp.net-corecontainersdocker-for-windows

Visual Studio Installing Windows ASP.NET Core into Docker Linux Container?


I am doing an F5 debug in Visual Studio of a number of microservices running under Linux docker containers. I know the containers are Linux because

  • Docker for Windows says Switch to Windows Containers on its menu
  • docker container inspect against my containers shows "Platform": "linux".

Without any obvious changes to docker-compose or dockerfile files it "feels" like ASP.NET core thinks it is running in a Windows environment. It appears like Visual Studio is causing this.

I get a lot of

  • PlatformNotSupportedException
  • NotSupportedException
  • DirectoryNotFoundException
  • DllNotFoundException
  • Cannot find or open the PDB file
  • realpath(): Invalid argument

and

You may only use the Microsoft .NET Core Debugger (vsdbg) with Visual Studio Code, Visual Studio or Visual Studio for Mac software to help you develop and test your applications.

This appeared to begin without warning. I've tried all of the following:

  • restart docker
  • reboot
  • uninstall/reinstall docker
  • use an older version of the codebase

Nothing seems to work.

Some of the microservices appear to work normally, just slower because exceptions are thrown everywhere. It just may be they aren't making platform specific calls though.

docker version shows

Client: Docker Engine - Community
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:34:26 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:41:49 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Has anyone encountered this before? Does anyone know of a fix?


Solution

  • Repairing Visual Studio via the Repair option in Visual Studio Installer fixed the problem.

    Unfortunately, I don't know what the root cause was.