Description
Summary
Silk.NET seems to have some native dependency resolving logic that fails to find the correct folder in runtimes/
on Pop!_OS 22.04.
Steps to reproduce
- Platform: Desktop, Pop!_OS 22.04 LTS, .NET SDK 9.0.106
- Framework Version: targetting .NET 8.0
- API: SDL (but probably the rest too, that's just the first failure)
- Try to import/use SDL from Silk.NET (just
GetApi()
is enough to trigger it) - Run program with
dotnet run
Comments
Running the program with strace
indicates that the paths being searched are bin/Debug/net8.0/runtimes/pop.22.04-x64/native/libSDL2-2.0.so
, followed by a bunch of system library paths. Obviously, the actual library it should be finding is in runtimes/linux-x64
and not runtimes/pop.22.04-x64
.
I looked into the logic for selecting this path and it seems that this RID is coming from Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetRuntimeIdentifier
, in two places:
and
I saw inside Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetRuntimeIdentifier
that this can be overridden by an environment variable, so I tested by setting export DOTNET_RUNTIME_ID=linux-x64
and this did allow packages to load, but this isn't really a "proper" solution.
I saw here that this package is removed from newer versions and on NuGet it seems to not have been updated in almost 5 years.
I also tested and found it gave a different result to the built-in API:
> Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetRuntimeIdentifier()
"pop.22.04-x64"
> System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier
"ubuntu.22.04-x64"
Metadata
Metadata
Assignees
Type
Projects
Status