Description
Based on the discussion in #57610 we were under the impression that using GetMainProgramHandle() in tandem with NativeLibrary.SetDllImportResolver() would be a replacement for having to modify third party packages to use [DllImport("_Internal")] on iOS. So far in testing on .NET 7 this has not been the case.
I created a sample native iOS library (libsayhello) and a wrapping C# lib which handles [DllImport("libsayhello')]. Then within a sample Maui app I added Interop code to allow my lib to be statically linked into the main application at compile time, then attempted to catch the resolution of 'libsayhello' in the import resolver and return the handle returned by GetMainProgramHandle().
Reproduction Steps
A test app showing the behavior is located at stanger/ResolverTest.
Expected behavior
DllImport calls for 'libsayhello' should be able to resolved to their statically linked symbols in the main binary.
Actual behavior
DllNotFoundException
Regression?
No response
Known Workarounds
No response
Configuration
.NET: 7.0.100-rc.2.22477.23
iOS 16 and MacOS 13 (originally discovered on iOS)
Tested on x64 and ARM64
Other information
No response