I'm running the basic dotnetcore example in docker and it works fine. Everything builds and my API is available. It also listens to live-changes which is perfect. You can find the Dockerfile and docker-compose at the bottom of the question.
However, I'm trying to work with the code using Visual-studio-code (insiders and regular) combined with omnisharp (default c# extension) and it keeps crashing on me.
It will work for a few seconds and after that stick me with 180+ "problems", all of which are false (the app works..)
The output doesn't indicate anything imo (from restart till crash):
Starting OmniSharp server at 7/3/2018, 11:52:55 AM
Target: /home/mastermindzh/code/
OmniSharp server started
Path: /home/mastermindzh/.vscode-insiders/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/run
PID: 2323
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on arch 0.0 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 15.0 - "/home/mastermindzh/.vscode-insiders/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/mastermindzh/.vscode-insiders/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 15.0 - "/home/mastermindzh/.vscode-insiders/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin"
MSBuildExtensionsPath = /home/mastermindzh/.vscode-insiders/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild
BypassFrameworkInstallChecks = true
CscToolPath = /home/mastermindzh/.vscode-insiders/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Roslyn
CscToolExe = csc.exe
MSBuildToolsPath = /home/mastermindzh/.vscode-insiders/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/home/mastermindzh/code/'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
Initializing in /home/mastermindzh/code/
[info]: OmniSharp.DotNet.DotNetProjectSystem
Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
Resolving projects references
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in '/home/mastermindzh/code/'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/mastermindzh/code//api/api.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/home/mastermindzh/code/'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.Stdio.Host
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/home/mastermindzh/code/' on host 30096.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/mastermindzh/code//api/api.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/home/mastermindzh/code//api/api.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: api
After this the extension just doesn't work anymore untill I restart it and it crashes again. This only fails when launching in Docker or from the cli, if I run the app through vscode (something I don't want to do) it works fine.
Dockerfile:
FROM microsoft/dotnet:2.1-sdk-stretch
WORKDIR /app
EXPOSE 5000
CMD dotnet restore && dotnet watch run
Compose:
version: "3"
services:
web:
build:
context: ./../../api
dockerfile: ./../docker/images/api/Dockerfile
ports:
- "5000:5000"
- "5001:5001"
volumes:
- ./../../api/:/app
depends_on:
- db
My best guess so far is that it's got something to do with dotnet restore and/or the bin/obj folders. Running a dotnet clean and then starting the app makes no difference.
Any help would be greatly appreciated.