Bug: After Mac running for a while, Omnisharp cannot find any SDKs
See original GitHub issueEnvironment data
dotnet --info
output:
.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.7.21379.14
Commit: 22d70b47bc
Runtime Environment:
OS Name: Mac OS X
OS Version: 11.5
OS Platform: Darwin
RID: osx.11.0-x64
VS Code version: 1.59.0 C# Extension version: v1.23.14
OmniSharp log
Logs
Starting OmniSharp server at 8/30/2021, 5:24:24 PM Target: /Users/USER_NAME/Documents/code/csharp/_tests/HttpClient
OmniSharp server started. Path: /Users/USER_NAME/.vscode/extensions/ms-dotnettools.csharp-1.23.14/.omnisharp/1.37.14/run PID: 20133
Starting OmniSharp on MacOS 11.5.2 (x64)
DotNetPath set to dotnet
Located 1 MSBuild instance(s)
1: StandAlone 17.0.0 - "/Users/USER_NAME/.vscode/extensions/ms-dotnettools.csharp-1.23.14/.omnisharp/1.37.14/omnisharp/.msbuild/Current/Bin"
MSBUILD_EXE_PATH environment variable set to '/Users/USER_NAME/.vscode/extensions/ms-dotnettools.csharp-1.23.14/.omnisharp/1.37.14/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
Registered MSBuild instance: StandAlone 17.0.0 - "/Users/USER_NAME/.vscode/extensions/ms-dotnettools.csharp-1.23.14/.omnisharp/1.37.14/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /Users/USER_NAME/.vscode/extensions/ms-dotnettools.csharp-1.23.14/.omnisharp/1.37.14/omnisharp/.msbuild/Current/Bin
CscToolPath = /Users/USER_NAME/.vscode/extensions/ms-dotnettools.csharp-1.23.14/.omnisharp/1.37.14/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /Users/USER_NAME/.vscode/extensions/ms-dotnettools.csharp-1.23.14/.omnisharp/1.37.14/omnisharp/.msbuild
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
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
Detecting Cake files in '/Users/USER_NAME/Documents/code/csharp/_tests/HttpClient'.
Could not find any Cake files
No solution files found in '/Users/USER_NAME/Documents/code/csharp/_tests/HttpClient'
Queue project update for '/Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/HttpClient.csproj'
Detecting CSX files in '/Users/USER_NAME/Documents/code/csharp/_tests/HttpClient'.
Could not find any CSX files
Configuration finished.
Omnisharp server running using Stdio at location '/Users/USER_NAME/Documents/code/csharp/_tests/HttpClient' on host 20091.
Loading project: /Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/HttpClient.csproj
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download
warn: OmniSharp.MSBuild.ProjectManager
Failed to load project file ‘/Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/HttpClient.csproj’.
/Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/HttpClient.csproj(0,0)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK ‘Microsoft.NET.Sdk’ specified could not be found. /Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/HttpClient.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00040] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1] (System.Boolean condition, System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00003] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00000] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpressionConditioned (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.Collections.Generic.List
1[Microsoft.Build.Construction.ProjectRootElement]& projects, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult, System.Boolean throwOnFileNotExistsError) [0x0032a] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult) [0x00027] in <e78286a6f9b047bca66ad86e9b031ef5>:0 at Microsoft.Build.Evaluation.Evaluator
4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x0000d] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <e78286a6f9b047bca66ad86e9b031ef5>:0 at Microsoft.Build.Evaluation.Evaluator
4[P,I,M,D].Evaluate () [0x0013b] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData
4[P,I,M,D] data, Microsoft.Build.Construction.ProjectRootElement root, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, System.Int32 maxNodeCount, Microsoft.Build.Collections.PropertyDictionary1[T] environmentProperties, Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Evaluation.IItemFactory
2[S,T] itemFactory, Microsoft.Build.Evaluation.IToolsetProvider toolsetProvider, Microsoft.Build.Evaluation.ProjectRootElementCacheBase projectRootElementCache, Microsoft.Build.Framework.BuildEventContext buildEventContext, Microsoft.Build.BackEnd.SdkResolution.ISdkResolverService sdkResolverService, System.Int32 submissionId, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext, System.Boolean interactive) [0x00047] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.Reevaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00063] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00035] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00000] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.ReevaluateIfNecessary (Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00007] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.Initialize (System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00127] in <e78286a6f9b047bca66ad86e9b031ef5>:0 at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary
2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00073] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Project…ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <e78286a6f9b047bca66ad86e9b031ef5>:0 at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary
2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.Project…ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection) [0x00000] in <e78286a6f9b047bca66ad86e9b031ef5>:0 at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.Collections.Generic.IDictionary
2[TKey,TValue] globalProperties, System.String toolsVersion) [0x000f7] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.String toolsVersion) [0x00000] in <e78286a6f9b047bca66ad86e9b031ef5>:0
at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore (System.String filePath, System.Collections.Generic.IReadOnlyDictionary2[TKey,TValue] projectConfigurationsInSolution) [0x00160] in <123e9399922f43fb93d71bfa60dd04d6>:0 at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath, System.Collections.Generic.IReadOnlyDictionary
2[TKey,TValue] configurationsInSolution) [0x0000d] in <123e9399922f43fb93d71bfa60dd04d6>:0
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load (System.String filePath, OmniSharp.MSBuild.ProjectIdInfo projectIdInfo, OmniSharp.MSBuild.ProjectLoader loader, System.Guid sessionId, OmniSharp.Services.DotNetInfo dotNetInfo) [0x00023] in <123e9399922f43fb93d71bfa60dd04d6>:0
at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass31_0.<LoadProject>b__0 () [0x00000] in <123e9399922f43fb93d71bfa60dd04d6>:0
at (wrapper delegate-invoke) System.Func1[System.ValueTuple
3[OmniSharp.MSBuild.ProjectFile.ProjectFileInfo,System.Collections.Immutable.ImmutableArray1[OmniSharp.MSBuild.Logging.MSBuildDiagnostic],OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs]].invoke_TResult() at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject (System.String projectFilePath, System.Func
1[TResult] loader) [0x0001b] in <123e9399922f43fb93d71bfa60dd04d6>:0
Attempted to update project that is not loaded: /Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/HttpClient.csproj
Solution initialized -> queue all documents for code analysis. Initial document count: 0.
Miscellaneous file: /Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/Program.cs added to workspace
No symbol found. File: /Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/Program.cs, Line: 4, Column: 10.
No symbol found. File: /Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/Program.cs, Line: 4, Column: 10.
No symbol found. File: /Users/USER_NAME/Documents/code/csharp/_tests/HttpClient/Program.cs, Line: 4, Column: 10.
Steps to reproduce
- do other businesses on the Mac for a long time
- find a place and do
dotnet new console
- go to Output -> Omnisharp Log
Expected behavior
Omnisharp should find the installed .NET SDKs
Actual behavior
Omnisharp cannot find the installed .NET SDKs
Workaround
The current workaround is to reboot the Mac but it won’t be convenient if there were many unsaved workloads running in the system.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Ah, that makes sense. If Automator doesn’t load the shell configuration, then your Environment variables won’t be setup properly. Going to close this one. Thanks!
Workaround
Do
export PATH=...
at the beginning of the Automator script then docode "$*"
.