Error when creating new files
See original GitHub issueIssue Description
Hello!
I’m having some trouble using VSCode and the C# extension. Everytime I create a new file, the Intellisense doens’t work, not showing any errors (red underline) on the file. The OmniSharp Log output shows the following message:
Could not find document for file /Users/rafaelmaia/source/personal/dotnet/Commander/Data/Mock.cs
I reinstalled VSCode and deleted all my extensions folder rm -rf ~/.vscode*, just installed the C# extension and the error persists.
I’m using VSCode version 1.50.1 on a macOS Cataline 10.15.7, dotnet sdk 3.1.403
Steps to Reproduce
Clean Install of VSCode
Install C# extension
Create a dotnet webapi project
dotnet new webapi -n Test
Create a new file
Write something
ex: aaaaaa
Expected Behavior
The expect behavior would be the line written with a red underscore, indicating an error.
Actual Behavior
Nothing happens, and you can check errors popping on the OmniSharp Log
[info]: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService
Could not find document for file /Users/rafaelmaia/source/personal/dotnet/Teste/Controllers/teste.cs
Logs
OmniSharp log
Starting OmniSharp server at 11/5/2020, 4:28:59 AM Target: /Users/rafaelmaia/source/personal/dotnet/Commander
OmniSharp server started. Path: /Users/rafaelmaia/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/run PID: 94751
Starting OmniSharp on MacOS 10.15.7 (x64)
DotNetPath set to dotnet
Located 1 MSBuild instance(s)
1: StandAlone 16.8.0 - "/Users/rafaelmaia/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
MSBUILD_EXE_PATH environment variable set to '/Users/rafaelmaia/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
Registered MSBuild instance: StandAlone 16.8.0 - "/Users/rafaelmaia/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /Users/rafaelmaia/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin
CscToolPath = /Users/rafaelmaia/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /Users/rafaelmaia/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild
Detecting Cake files in '/Users/rafaelmaia/source/personal/dotnet/Commander'.
Could not find any Cake files
No solution files found in '/Users/rafaelmaia/source/personal/dotnet/Commander'
Queue project update for '/Users/rafaelmaia/source/personal/dotnet/Commander/Commander.csproj'
Detecting CSX files in '/Users/rafaelmaia/source/personal/dotnet/Commander'.
Could not find any CSX files
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
Loading project: /Users/rafaelmaia/source/personal/dotnet/Commander/Commander.csproj
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
Configuration finished.
Omnisharp server running using Stdio at location '/Users/rafaelmaia/source/personal/dotnet/Commander' on host 94627.
Successfully loaded project file '/Users/rafaelmaia/source/personal/dotnet/Commander/Commander.csproj'.
Adding project '/Users/rafaelmaia/source/personal/dotnet/Commander/Commander.csproj'
Update project: Commander
Could not find document for file /Users/rafaelmaia/source/personal/dotnet/Commander/Data/teste1.cs
Could not find document for file /Users/rafaelmaia/source/personal/dotnet/Commander/Data/teste1.cs
Could not find document for file /Users/rafaelmaia/source/personal/dotnet/Commander/Data/teste1.cs
Could not find document for file /Users/rafaelmaia/source/personal/dotnet/Commander/Data/teste1.cs
Could not find document for file /Users/rafaelmaia/source/personal/dotnet/Commander/Data/teste1.cs
Could not find document for file /Users/rafaelmaia/source/personal/dotnet/Commander/Data/teste1.cs
Could not find document for file /Users/rafaelmaia/source/personal/dotnet/Commander/Data/teste1.cs
C# log
Nothing on C# Log.
Environment information
VSCode version: 1.50.1 C# Extension: 1.23.5
Mono Information
OmniSharp using built-in monoDotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.1.403 Commit: 9e895200cdRuntime Environment: OS Name: Mac OS X OS Version: 10.15 OS Platform: Darwin RID: osx.10.15-x64 Base Path: /usr/local/share/dotnet/sdk/3.1.403/
Host (useful for support): Version: 3.1.9 Commit: 774fc3d6a9
.NET Core SDKs installed: 2.0.3 [/usr/local/share/dotnet/sdk] 2.1.3 [/usr/local/share/dotnet/sdk] 3.1.403 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
csharp | ms-dotnettools | 1.23.5 |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:31 (10 by maintainers)
Top GitHub Comments
For those of you who are still seeing this and aren’t adding non csharp files (like tcroc is) please file a new issue with specific repro steps. I use the extension every day and have yet to reproduce the issue with csharp files, so more info is needed.
This minimal example works for me having set
omnisharp.path
tolatest
, however within a Unity project adding a new C# script isn’t recognised and I get the “Could not find document for file” warning, no autocompletions or reference counterI’m using VSCodium 1.52.0, C# extension 1.23.7. I’m not massively familiar with C# development so please let me know what other debug info you need if you do