-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Description
See #89782 (comment) for details.
The failure is really weird - I can confirm that the native dll is next to the AOT compiled app.
Non-AOT version of the app can load the dll just fine (it fails later on for me, but that's not the issue here).
I also tried just a simple app with a PInvoke (using Libuv package and calling into it) and that works just fine even with NativeAOT.
Repro steps:
https://github.com/dotnet/runtime/files/12243049/sqlClient.zip
Publish as AOT and run on win-x64.
Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'sni.dll' or one of its dependencies: The specified module could not be found.
at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0x6f
at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0xfd
at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x2f
at System.Data.SqlClient.SNINativeMethodWrapper.UnmanagedIsTokenRestricted(IntPtr, Boolean&) + 0x31
at System.Data.Win32NativeMethods.IsTokenRestrictedWrapper(IntPtr) + 0x19
at System.Data.ProviderBase.DbConnectionPoolIdentity.GetCurrentNative() + 0xb0
at System.Data.ProviderBase.DbConnectionPoolGroup.GetConnectionPool(DbConnectionFactory) + 0x51
at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPool(DbConnection, DbConnectionPoolGroup) + 0x5f
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection, TaskCompletionSource`1, DbConnectionOptions, DbConnectionInternal, DbConnectionInternal&) + 0xb6
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection, DbConnectionFactory, TaskCompletionSource`1, DbConnectionOptions) + 0x118
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1) + 0x101
at System.Data.SqlClient.SqlConnection.Open() + 0xf8
at Program.<Main>$(String[] args) + 0x45
at sqlClient!<BaseAddress>+0x413074
Reactions are currently unavailable