"Type or namespace name ... could not be found" for some symbols
See original GitHub issueIssue Description
Opened a Unity project that previously worked and now some symbols are not recognized.
Steps to Reproduce
Open project
Expected Behavior
No errors
Actual Behavior
Several erroneous errors about missing symbols. In the logs there a System.ArgumentOutOfRangeException as a response.
Logs
OmniSharp log
OmniSharp server started with Mono 6.8.0. Path: /home/megan/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/OmniSharp.exe PID: 2983
Starting OmniSharp on fedora 33.0 (x64)
DotNetPath set to dotnet
Located 1 MSBuild instance(s)
1: StandAlone 16.8.0 - "/home/megan/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
MSBUILD_EXE_PATH environment variable set to '/home/megan/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
Registered MSBuild instance: StandAlone 16.8.0 - "/home/megan/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /home/megan/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/megan/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /home/megan/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild
Detecting Cake files in '/home/megan/w/CVTest'.
Could not find any Cake files
Detecting projects in '/home/megan/w/CVTest/CVTest.sln'.
Queue project update for '/home/megan/w/CVTest/UnityEngine.UI.csproj'
Queue project update for '/home/megan/w/CVTest/Assembly-CSharp.csproj'
Queue project update for '/home/megan/w/CVTest/Unity.2D.Sprite.Editor.csproj'
Queue project update for '/home/megan/w/CVTest/UnityEditor.UI.csproj'
Queue project update for '/home/megan/w/CVTest/Unity.2D.Tilemap.Editor.csproj'
Detecting CSX files in '/home/megan/w/CVTest'.
Could not find any CSX files
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
Loading project: /home/megan/w/CVTest/UnityEngine.UI.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 '/home/megan/w/CVTest' on host 2831.
Successfully loaded project file '/home/megan/w/CVTest/UnityEngine.UI.csproj'.
Adding project '/home/megan/w/CVTest/UnityEngine.UI.csproj'
Loading project: /home/megan/w/CVTest/Assembly-CSharp.csproj
Successfully loaded project file '/home/megan/w/CVTest/Assembly-CSharp.csproj'.
Adding project '/home/megan/w/CVTest/Assembly-CSharp.csproj'
Loading project: /home/megan/w/CVTest/Unity.2D.Sprite.Editor.csproj
Successfully loaded project file '/home/megan/w/CVTest/Unity.2D.Sprite.Editor.csproj'.
Adding project '/home/megan/w/CVTest/Unity.2D.Sprite.Editor.csproj'
Loading project: /home/megan/w/CVTest/UnityEditor.UI.csproj
Successfully loaded project file '/home/megan/w/CVTest/UnityEditor.UI.csproj'.
Adding project '/home/megan/w/CVTest/UnityEditor.UI.csproj'
Loading project: /home/megan/w/CVTest/Unity.2D.Tilemap.Editor.csproj
Successfully loaded project file '/home/megan/w/CVTest/Unity.2D.Tilemap.Editor.csproj'.
Adding project '/home/megan/w/CVTest/Unity.2D.Tilemap.Editor.csproj'
Update project: UnityEngine.UI
Update project: Assembly-CSharp
Update project: Unity.2D.Sprite.Editor
Update project: UnityEditor.UI
Update project: Unity.2D.Tilemap.Editor
************ Response ************
{
“Request_seq”: 8,
“Command”: “/v2/highlight”,
“Running”: true,
“Success”: false,
“Message”: “"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\nParameter name: line\n at Microsoft.CodeAnalysis.Text.LinePosition…ctor (System.Int32 line, System.Int32 character) [0x00004] in <74e762f007514b0991a005183ec8dcb2>:0 \n at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.Handle (OmniSharp.Models.SemanticHighlight.SemanticHighlightRequest request) [0x00146] in <8ca5e445b15640a0986680e5a0180b25>:0 \n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler
2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \\n at OmniSharp.Endpoint.EndpointHandler
2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000e7] in <add5f40a6e784fcca3e930b59965388b>:0 "”,
“Body”: null,
“Seq”: 66,
“Type”: “response”
}
fail: OmniSharp.Stdio.Host
************ Response ************
{
“Request_seq”: 14,
“Command”: “/v2/highlight”,
“Running”: true,
“Success”: false,
“Message”: “"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\nParameter name: line\n at Microsoft.CodeAnalysis.Text.LinePosition…ctor (System.Int32 line, System.Int32 character) [0x00004] in <74e762f007514b0991a005183ec8dcb2>:0 \n at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.Handle (OmniSharp.Models.SemanticHighlight.SemanticHighlightRequest request) [0x00146] in <8ca5e445b15640a0986680e5a0180b25>:0 \n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler
2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \\n at OmniSharp.Endpoint.EndpointHandler
2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000e7] in <add5f40a6e784fcca3e930b59965388b>:0 "”,
“Body”: null,
“Seq”: 83,
“Type”: “response”
}
C# log
Environment information
VSCode version: 1.51.1 C# Extension: 1.23.6
Mono Information
OmniSharp using global mono :6.8.0Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.1.109 Commit: 32ced2d411Runtime Environment: OS Name: fedora OS Version: 33 OS Platform: Linux RID: fedora.33-x64 Base Path: /usr/lib64/dotnet/sdk/3.1.109/
Host (useful for support): Version: 3.1.9 Commit: 774fc3d6a9
.NET Core SDKs installed: 3.1.109 [/usr/lib64/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.9 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.9 [/usr/lib64/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 |
---|---|---|
ayu | teabyii | 0.20.1 |
csharp | ms-dotnettools | 1.23.6 |
haskell | haskell | 1.2.0 |
language-haskell | justusadam | 3.3.0 |
material-icon-theme | PKief | 4.4.0 |
material-palenight-theme | whizkydee | 2.0.1 |
material-theme | zhuangtongfa | 3.9.11 |
monokai-operator-theme | markfknight | 4.0.0 |
night-owl | sdras | 2.0.0 |
nord-operator-theme | Chad | 1.0.0 |
one-monokai | azemoh | 0.5.0 |
one-monokai-italics | iamkd | 0.4.0 |
operatormonodarktheme | Valiantsin | 1.0.1 |
snazzy-operator-plus | bsides | 1.2.1 |
theme-dracula | dracula-theme | 2.22.3 |
tomorrow-and-tomorrow-night-operator-mono-theme | chiragpat | 0.0.6 |
tomorrow-and-tomorrow-night-operator-mono-theme-tweaked | stonebuddha | 0.1.1 |
twilight-operator | stevemcgrath | 0.0.1 |
unity-debug | Unity | 3.0.2 |
vim | vscodevim | 1.17.1 |
vsc-community-material-theme | Equinusocio | 1.4.2 |
vsc-material-theme-icons | equinusocio | 1.2.0 |
vscode-great-icons | emmanuelbeziat | 2.1.61 |
vscode-simple-icons | LaurentTreguier | 1.13.5 |
vscode-theme-onedark | akamud | 2.2.2 |
winteriscoming | johnpapa | 1.4.3 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Oh after also regenerating files it looks like it figured everything out! Thanks!
For Mono-based development (e.g. Unity) that requires full .NET framework, you need to set
"omnisharp.useGlobalMono": "always"
in VS Code settings.This is mentioned in the known issues in release notes - https://github.com/OmniSharp/omnisharp-vscode/blob/8f7b3d21b5cdb04d6cf725302503d91099d95164/CHANGELOG.md#known-issues-in-1236