runtime: iOS (and other Apple platforms): the BCL has P/Invokes to libraries and/or functions that don't exist
Description
There are several DllImports in the BCL for iOS (and the other Apple platforms) that contain references to native functions that don’t exist. It’s highly preferable to not have any P/Invokes to native functions that don’t exist, because it allows the AOT compiler to generate more efficient code. It also makes other performance improvements possible.
-
System.Diagnostics.Process.dl
- P/Invoke to
SystemNative_ConfigureTerminalForChildProcessinlibSystem.Native.dylib, butlibSystem.Native.dylibdoesn’t provide that function. Tracked in #47910
- P/Invoke to
-
System.Net.Quic.dll
-
MsQuicOpenLibrary:libmsquic.dylib
-
-
System.Reflection.Metadata.dll
-
ReadFileLibrary:kernel32.dll
-
-
System.Security.Cryptography.Algorithms.dll, System.Security.Cryptography.OpenSsl.dll and System.Security.Cryptography.X509Certificates.dll
- Numerous references to functions in
libSystem.Security.Cryptography.Native.Apple.dylibof the formAppleCryptoNative_*orCryptoNative_*. Tracked in #47910
- Numerous references to functions in
-
System.Private.CoreLib.dll
- Numerous references to functions in
libSystem.Globalization.Native.dylibof the formGlobalizationNative_*. I believe this is because of pending work (issue #?)
- Two functions from
libhostpolicy.dylib(corehost_resolve_component_dependenciesandcorehost_set_error_writer). This has also been reported in #38543.
- Numerous references to functions in
This is from the microsoft.netcore.app.runtime.ios-arm64 pack (6.0.0-alpha.1.21063.13).
Full output from custom tool I wrote: https://gist.github.com/rolfbjarne/b9a6f16d2a6697c0d8dfc46c39160404
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 15 (15 by maintainers)
Commits related to this issue
- Workaround dotnet/runtime#47533 and avoid listing required symbols when native libraries are dynamically linked — committed to filipnavara/xamarin-macios by filipnavara 3 years ago
- Workaround dotnet/runtime#47533 and avoid listing required symbols when native libraries are dynamically linked — committed to filipnavara/xamarin-macios by filipnavara 3 years ago
- Workaround dotnet/runtime#47533 and avoid listing required symbols when native libraries are dynamically linked — committed to filipnavara/xamarin-macios by filipnavara 3 years ago
- Workaround dotnet/runtime#47533 and avoid listing required symbols when native libraries are dynamically linked — committed to filipnavara/xamarin-macios by filipnavara 3 years ago
- [dotnet] Handle `lib` prefix for P/Invokes for runtime native libraries (#11158) * Workaround dotnet/runtime#47533 and avoid listing required symbols when native libraries are dynamically linked *... — committed to xamarin/xamarin-macios by filipnavara 3 years ago
Actually it’s worse because in some cases the Interop code is called on the managed side and fails in very unpredictable fashion. This was one reported instance on Discord: