-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Native Library loading IOS Frameworks in .NET 10 #129798
Description
Apple platform
iOS
Framework version
net10.0-*
Affected platform version
SDK 10.0.300, Manifest 36.1.69/10.0.100
Description
Previous issue on this: dotnet/macios#24266
Relevant issue: realm/realm-dotnet#3711
We're trying to update our app from .NET 8 to .NET 10 and encountering issues because our apps can no longer load their native libraries.
The breaking change is documented here: https://learn.microsoft.com/en-us/dotnet/core/compatibility/interop/10.0/native-library-search
I could be wrong, but it looks to be tracked back to this PR on dotnet/runtime: #115236
The breaking (no longer functional) code looks like this:
if (OperatingSystem.IsIOS()) NativeLibrary.SetDllImportResolver(typeof(VeldridSpirvNative).Assembly, (_, assembly, path) => NativeLibrary.Load("@rpath/veldrid-spirv.framework/veldrid-spirv", assembly, path));
With the suggested change being (as far as I understand):
if (OperatingSystem.IsIOS()) NativeLibrary.SetDllImportResolver(typeof(VeldridSpirvNative).Assembly, (_, assembly, path) => NativeLibrary.Load("@rpath/veldrid-spirv.framework/veldrid-spirv", assembly, path | DllImportSearchPath.ApplicationDirectory));
Before I go and update about 5 different projects and begin a cycle of dependency updates, I want to ask whether this is really intended behaviour?
Steps to Reproduce
I was going to provide some steps here, but I'm uncovering even more issues that makes this very annoying to create a reproduction for. It's just a question anyway.
Did you find any workaround?
As mentioned in the description.
Relevant logs
No response