LINQPad has a beta release for macOS, but I can’t seem to get it to work without installing .NET in the non-Nix way (the installer downloaded from .NET | Build. Test. Deploy.).
(Of note might be that the only way to install LINQPad currently is downloading a .dmg
file.)
Installing .NET in a nix-shell or similar to avoid polluting the global stuff doesn’t work at all, LINQPad cannot find it (unlike something like JetBrains Rider, which is able to find .NET just fine when launched from a terminal with a .NET Nix package available).
And even when installing .NET globally in nix-darwin:
environment.systemPackages = with pkgs; [
(with dotnetCorePackages;
combinePackages [
sdk_9_0
sdk_8_0
])
];
It doesn’t work (LINQPad claims to not be able to find .NET). Some progress is made if setting the DOTNET_ROOT
environment variable to point at the SDK dir:
$ echo $DOTNET_ROOT
/nix/store/5dlwlpgw400fghdpnq2ibxbf5appfjxy-dotnet-combined/share/dotnet/
But then it instead throws an error about not being able to find Avalonia:
$ /Applications/LINQPad\ 8\ beta.app/Contents/MacOS/LINQPad8
Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'Avalonia.Controls, Version=11.3.999.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'. The parameter is incorrect.
(0x80070057 (E_INVALIDARG))
File name: 'Avalonia.Controls, Version=11.3.999.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'
---> System.ArgumentException: An item with the same key has already been added. Key: System.Private.CoreLib
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at LINQPad.TPA.get_Fx()
at LINQPad.Loader.RuntimeAssemblyResolver.ResolveAssembly(AssemblyLoadContext alc, String simpleName, Version version)
at LINQPad.Loader.RuntimeAssemblyServices.<>c.<ConfigureForGuiDefaultALC>b__5_0(AssemblyLoadContext context, AssemblyName assemName)
at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at LINQPad.UI.ErrorReporting.ErrorReporter.Report(String[] args)
at LINQPad.UI.UILoader.Start(String[] args)
at LINQPad.UI.TestHarness.ContinueWithHostContext(String[] args)
at LINQPad.UI.TestHarness.Go(String[] args)
at LINQPad.UI.UILoader.Main(String[] args)
(Perhaps running the executable inside the .app
folder is just not supported at all for these kinds of apps, but just opening the application the normal way just results in it not finding .NET at all.)
Any other nix-darwin users who’ve had success trying to run LINQPad? Or just .NET/Avalonia apps (that are not in nixpkgs) in general? Am I just doomed to have to keep .NET globally unmanaged by Nix?