using c# in zed

three weeks ago I decided to try out the Zed IDE after hearing good stuff about it from friends and colleagues.

using it while working has been pretty nice so far, it feels super slick, but for some reason I’ve “struggled” a bit while coding in C#.

when I’ve got C# files open I’ve gotten the following error:

Language server error: omnisharp

oneshot canceled
-- stderr--
A fatal error occurred. The required library libhostfxr.dylib could not be found.
If this is a self-contained application, that library should exist in [/Users/sid/Library/Application Support/Zed/extensions/work/csharp/omnisharp-v1.39.13/].
If this is a framework-dependent application, install the runtime in the global location [/usr/local/share/dotnet/x64] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].

The .NET runtime can be found at:
  - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=arm64&rid=osx.11.4-arm64&apphost_version=6.0.0-preview.7.21317.1

after a while of troubleshooting and digging online I came across this GitHub issue - which solved it for me!

In short, open up /etc/dotnet/install_location and change the value from /usr/local/share/dotnet/x64 to /usr/local/share/dotnet. Additionally, there was another workaround which could be implemented within the Zed settings directly by adding the following:

"env": {
  "DOTNET_ROOT": "/usr/local/share/dotnet"
}

thanks to this fix I’ve now become a 10x developer (lol)

hope this helps someone, looks like that’s the theme I’m going for lately.

My custom jolly roger