Skip to content

System.TypeInitializationException Unable to load DLL : sni.dll when attempting to get SQL data but DLL is present #4162

@dan-dragan

Description

@dan-dragan

This is an issue in DNX and dotnet CLI (tracked by aspnet/dnx#3316 & dotnet/cli#881). We are leaving this issue open to track the high level scenario on the EF side and ensure everything works end-to-end for the RC2 release.


Stack trace:
Exception thrown: 'System.TypeInitializationException' in EntityFramework.Core.dll
Exception caught: 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)

runtime info :

D:\Work\repo\Web>dnvm list

Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
       1.0.0-beta5       clr     x64          win
       1.0.0-beta5       clr     x86          win
       1.0.0-beta5       coreclr x64          win
       1.0.0-beta5       coreclr x86          win
       1.0.0-beta6       clr     x64          win
       1.0.0-beta6       clr     x86          win
       1.0.0-beta6       coreclr x64          win
       1.0.0-beta6       coreclr x86          win
       1.0.0-beta8       clr     x64          win
       1.0.0-beta8       clr     x86          win
       1.0.0-beta8       coreclr x64          win
       1.0.0-beta8       coreclr x86          win
       1.0.0-rc1-final   clr     x86          win
       1.0.0-rc1-final   coreclr x64          win
       1.0.0-rc1-final   coreclr x86          win
       1.0.0-rc1-update1 clr     x64          win
       1.0.0-rc1-update1 clr     x86          win             default
       1.0.0-rc1-update1 coreclr x64          win
       1.0.0-rc1-update1 coreclr x86          win
       1.0.0-rc2-16258   clr     x86          win

Using VS2015 debugger:
dnx runtime

project.json content:

{
  "webroot": "wwwroot",
  "version": "1.0.0-beta1-*",

  "content": "EnvironmentSettings.json",

  "dependencies": {

    "Platform.AspNet.Authentication.Diagnostics": "1.0.0-beta1-*",
    "Platform.AspNet.Authentication.DPerms": "1.0.0-beta1-*",
    "Platform.AspNet.Discovery": "1.0.0-beta1-*",
    "Platform.AspNet.Monitoring": "1.0.0-beta1-*"
  },

  "commands": {
    "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5004"
  },

  "frameworks": {
    "dnxcore50": {
      "dependencies": {
        "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
        "Microsoft.AspNet.Mvc.Core": "6.0.0-rc1-final",
        "Microsoft.AspNet.Mvc.ViewFeatures": "6.0.0-rc1-final",
        "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
        "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
        "Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
        "Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final",
        "Platform.Authentication": "1.0.0-rc1-final",
        "Microsoft.Extensions.OptionsModel": "1.0.0-rc1-final",
        "EntityFramework.Core": "7.0.0-rc1-final",
        "Microsoft.AspNet.Authentication": "1.0.0-rc1-final",
        "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
        "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
        "Microsoft.AspNet.FileProviders.Physical": "1.0.0-rc1-final",
        "Microsoft.Extensions.Configuration.Binder": "1.0.0-rc1-final",
        "Microsoft.AspNet.Hosting.Abstractions": "1.0.0-rc1-final",

        "Microsoft.AspNet.Identity": "3.0.0-rc1-final",
        "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
        "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
        "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
        "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
        "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
        "System.Linq": "4.0.1-beta-*"
      }
    }
  },

  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ],
  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ]
}

File exists:
fileexists

Thanks for looking into this:

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions