question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: After Mac running for a while, Omnisharp cannot find any SDKs

See original GitHub issue

Environment 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.List1[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.Evaluator4[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.Evaluator4[P,I,M,D].Evaluate () [0x0013b] in <e78286a6f9b047bca66ad86e9b031ef5>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData4[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.IItemFactory2[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.IDictionary2[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.IDictionary2[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.IDictionary2[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.IReadOnlyDictionary2[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.ValueTuple3[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.Func1[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

  1. do other businesses on the Mac for a long time
  2. find a place and do dotnet new console
  3. 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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
JoeRobichcommented, Aug 31, 2021

Automator script does not load the profile

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!

0reactions
Banyccommented, Aug 31, 2021

Workaround

Do export PATH=... at the beginning of the Automator script then do code "$*".

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Error on Visual Studio Code for OmniSharp with .Net6 ...
Try updating VS Code and Omnisharp to the latest versions. If does not help - install VS 2022 and try running VS Code...
Read more >
omnisharp-vscode - Discover .NET
Welcome to the C# extension for Visual Studio Code! This extension provides the following features inside VS Code: Lightweight development tools for .NET...
Read more >
[Solved] Problems with OmniSharp and Visual Studio Code
SOLVED: Fixed the problem by reinstalling VS Code and the C# extension. I've used Visual Studio Code for few days now to edit...
Read more >
NETSDK1045: The current .NET SDK does not support 'newer ...
This error occurs when the build tools can't find the version of the .NET SDK that's needed to build a project. This is...
Read more >
Visual Studio Code - ArchWiki
These different flavors are all built from the Code - OSS repository, ... NET (using the OmniSharp extension) then you need to install...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found