Skip to content

SQL Client: Unable to load sni.dll (DllNotFoundException) #16048

@rowanmiller

Description

@rowanmiller

Several customers have reported errors loading sni.dll.

This is not the same as https://github.com/dotnet/corefx/issues/3760 because installing the Microsoft Visual C++ 2012 Redistributable does not resolve the issue.

Examples of the customer reports are on dotnet/efcore#4162. Many of those are seeing the error when using EF7 but have confirmed that the error reproduces when using SQL Client directly.

Several people have reported that the error occurs under the following environment

coreclr-x64-rc1-update1 with IIS 7.5 on Windows Server 2008 R2 with C++ redistributable installed (x64 & x86).

Full details of the exception...

The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception.Exception caught: The type initializer for 'System.Data.SqlClient.SNILoadHandle' threw an exception.Exception caught: Unable to load DLL 'C:\Users\ddragan\.dnx\packages\runtime.win7-x64.System.Data.SqlClient.sni\4.0.0-beta-23616\runtimes\win7-x64\native\sni.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)Exception thrown: 'System.TypeInitializationException' in Platform.Authentication
Exception thrown: 'System.TypeInitializationException' in mscorlib.ni.dll
Microsoft.AspNet.Diagnostics.ExceptionHandlerMiddleware:Error: An unhandled exception has occurred: The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception.
System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SNILoadHandle' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'C:\Users\ddragan\.dnx\packages\runtime.win7-x64.System.Data.SqlClient.sni\4.0.0-beta-23616\runtimes\win7-x64\native\sni.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at System.Runtime.Loader.AssemblyLoadContext.InternalLoadUnmanagedDllFromPath(String unmanagedDllPath)
   at Microsoft.Dnx.Runtime.Loader.PackageAssemblyLoader.LoadUnmanagedLibrary(String name)
   at Microsoft.Dnx.Host.LoaderContainer.LoadUnmanagedLibrary(String name)
   at Microsoft.Dnx.Runtime.Loader.LoadContext.LoadUnmanagedDll(String unmanagedDllName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUnmanagedDll(String unmanagedDllName, IntPtr gchManagedAssemblyLoadContext)
   at System.Data.SqlClient.SNINativeMethodWrapper.SNIInitialize(IntPtr pmo)
   at System.Data.SqlClient.SNILoadHandle..ctor()
   at System.Data.SqlClient.SNILoadHandle..cctor()
   --- End of inner exception stack trace ---
   at System.Data.SqlClient.TdsParser..cctor()
   --- End of inner exception stack trace ---
   at ExternalDataAccessor.GetFirm(String firmName)

Metadata

Metadata

Assignees

Labels

area-System.DatablockingMarks issues that we want to fast track in order to unblock other important workos-windowspackagingRelated to packaging

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions