Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rosyln failing to start on Mac x64 with 'image not found' error for hostfxr.dylib #6198

Closed
v-Judy opened this issue Aug 22, 2023 · 4 comments · Fixed by dotnet/roslyn#69769
Closed

Comments

@v-Judy
Copy link

v-Judy commented Aug 22, 2023

Environment data

dotnet --info output:

.NET SDK (reflecting any global.json):
Version: 6.0.317
Commit:    98282dc4ea
Runtime Environment:
OS Name:     Mac OS X
OS Version:  11.6
OS Platform: Darwin
RID:         osx.11.0-x64
Base Path:   /usr/local/share/dotnet/sdk/6.0.317/
global.json file:
  Not found
Host:
  Version:      6.0.22
  Architecture: x64
  Commit:       ad40cc35b5
.NET SDKs installed:
  6.0.317 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.22 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

VS Code version: 1.81.1
C# Extension version: v2.0.376

Omnisharp log

C# logVersion:1.0 StartHTML:000000096 EndHTML:000005287 StartFragment:000000186 EndFragment:000005273

Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime

Found dotnet version 6.0.22. Minimum required version is 7.0.100.

Dotnet path: /Users/vs/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet

Activating C# standalone...

[Info - 4:26:50 PM] [Program]Language server initialized

[Error - 4:26:51 PM] [LanguageServerHost]System.DllNotFoundException: Unable to load shared library 'hostfxr' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable:

dlopen(/Users/vs/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/shared/Microsoft.NETCore.App/7.0.10/hostfxr.dylib, 1): image not found

dlopen(/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.0.376-darwin-x64/.roslyn/hostfxr.dylib, 1): image not found

dlopen(hostfxr.dylib, 1): image not found

dlopen(/Users/vs/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/shared/Microsoft.NETCore.App/7.0.10/libhostfxr.dylib, 1): image not found

dlopen(/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.0.376-darwin-x64/.roslyn/libhostfxr.dylib, 1): image not found

dlopen(libhostfxr.dylib, 1): image not found

dlopen(/Users/vs/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/shared/Microsoft.NETCore.App/7.0.10/hostfxr, 1): image not found

dlopen(/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.0.376-darwin-x64/.roslyn/hostfxr, 1): image not found

dlopen(hostfxr, 1): image not found

dlopen(/Users/vs/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/shared/Microsoft.NETCore.App/7.0.10/libhostfxr, 1): image not found

dlopen(/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.0.376-darwin-x64/.roslyn/libhostfxr, 1): image not found

dlopen(libhostfxr, 1): image not found

at Microsoft.Build.Locator.NativeMethods.hostfxr_resolve_sdk2(String exe_dir, String working_dir, hostfxr_resolve_sdk2_flags_t flags, hostfxr_resolve_sdk2_result_fn result)

at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetDotNetBasePaths(String workingDirectory)+MoveNext()

at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetInstances(String workingDirectory)+MoveNext()

at Microsoft.Build.Locator.MSBuildLocator.GetInstances(VisualStudioInstanceQueryOptions options)+MoveNext()

at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()

at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)

at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)

at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.TryEnsureMSBuildLoadedAsync(String workingDirectory) in /_/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 140

at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.OpenProjectsAsync(ImmutableArray`1 projectFilePaths) in /_/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 112

at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136

Steps to reproduce

  1. Create a folder and create a angular project in it:
mkdir Angular
cd Angular
dotnet new angular
  1. Navigate to the folder you created Angular and open VS Code using Terminal Emulator.
code .
  1. F5 to run the project.

Note

  1. This issue only repro on Mac BigSur OS
  2. This issue does not repro on C# v1.26.0

Actual behavior

An error pop up after F5 to run the project:
MicrosoftTeams-image
image

@gregg-miskelly gregg-miskelly changed the title [Mac]When F5 to run the project, VsCode will pop up an error window: "Cannot create .NET debug configurations... " Rosyln failing to start on Mac x64 Aug 22, 2023
@gregg-miskelly gregg-miskelly changed the title Rosyln failing to start on Mac x64 Rosyln failing to start on Mac x64 with 'image not found' error for hostfxr.dylib Aug 22, 2023
@dibarbet
Copy link
Member

@jasonmalinowski since you have an x64 mac, mind taking the first look? The extension platform and os platform and dotnet platform seem to match.

@JoeRobich
Copy link
Member

Seems related to microsoft/MSBuildLocator#230

@dibarbet
Copy link
Member

That does indeed look incredibly related. Thanks for the link!

@YuliiaKovalova
Copy link
Member

YuliiaKovalova commented Aug 30, 2023

The issue was addressed in the scope of dotnet/msbuild#9038

You can use the package with the fix https://www.nuget.org/packages/Microsoft.Build.Locator/1.6.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants