efcore icon indicating copy to clipboard operation
efcore copied to clipboard

sni.dll cannot be loaded on downlevel

Open victorhurdugaci opened this issue 11 years ago • 11 comments

This happens on Win7 and Win2008 R2. We are seeing it during the cross plat CI runs:

  1. http://projectk-tc/viewLog.html?buildId=89200&tab=buildLog&buildTypeId=XPlat_Windows7&logTab=tree#_focus=673
  2. http://projectk-tc/viewLog.html?buildId=89046&tab=buildResultsDiv&buildTypeId=XPlat_Windows7

The error is the same all the time:

System.DllNotFoundException : Unable to load DLL 'sni.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)

You can repro by using the MusicStore tests with KRE 1.0.0-beta3-11014 and EF 7.0.0-beta3-12128,or by building EF from the release branch and using the same KRE.

Later edit: it happens with the bits in the dev branch too.

victorhurdugaci avatar Feb 04 '15 18:02 victorhurdugaci

Investigation results:

sni.dll has some native dependencies that aren’t present on win 7:
API-MS-WIN-CORE-INTERLOCKED-L1-2-0.DLL
API-MS-WIN-CORE-NAMEDPIPE-L1-2-0.DLL
API-MS-WIN-SECURITY-BASE-L1-2-0.DLL

The CoreCLR drop that is packaged with XRE does have the L1-1-0 versions of these.

victorhurdugaci avatar Feb 06 '15 00:02 victorhurdugaci

Interesting that this person reported that swapping to x64 runtime resolved the issue https://github.com/aspnet/EntityFramework/issues/1701

rowanmiller avatar Feb 25 '15 19:02 rowanmiller

I got this error when using x64 Windows 7, x64 SQL Server 2014 Express, when I ran on x86 CLR. I switched to x64 CLR and the error went away. Maybe same issue?

swaggerloaf avatar Feb 25 '15 19:02 swaggerloaf

I was able to reproduce error. Doesn't seem to be related to x86 / x64 CLR But I used x86 CoreCLR and got the error

Active Version           Runtime Architecture Location                   Alias
------ -------           ------- ------------ --------                   -----
       1.0.0-beta3       clr     x64          C:\Users\Glenn\.k\runtimes
       1.0.0-beta3       clr     x86          C:\Users\Glenn\.k\runtimes
       1.0.0-beta3       coreclr x64          C:\Users\Glenn\.k\runtimes
       1.0.0-beta3       coreclr x86          C:\Users\Glenn\.k\runtimes
       1.0.0-beta4-11138 clr     x86          C:\Users\Glenn\.k\runtimes
  *    1.0.0-beta4-11138 coreclr x86          C:\Users\Glenn\.k\runtimes default

I first used 1.0.0-beta4-11138 clr x86 and that worked fine. then installed 1.0.0-beta4-11138 coreclr x86 and got the sni dll error on apply migration

I have Windows 7 SP1 x64, SQL Server 2014 Express x64 with CU6 applied When the coreclr got installs I see a few suspect messages during native image compile shown below but the runtime seems to work I would look at something related with CoreCLR anyway.

Failed to load type token 690029c5 for the profile data in [C:\Users\Glenn\.k\runtimes\kre-coreclr-win-x86.1.0.0-beta4-11138\bin\Microsoft.C
odeAnalysis.CSharp.dll] The type specified by the IBC data is no longer present in the assembly's metadata.  The type was [Microsoft.CodeAna
lysis]Microsoft.CodeAnalysis.ArrayBuilder`1+<>c__DisplayClass0.
Failed to load type token 69000bac for the profile data in [C:\Users\Glenn\.k\runtimes\kre-coreclr-win-x86.1.0.0-beta4-11138\bin\Microsoft.C
odeAnalysis.CSharp.dll] The type specified by the IBC data is no longer present in the assembly's metadata.  The type was [Microsoft.CodeAna
lysis]Microsoft.CodeAnalysis.CachingIdentityFactory`2+<>c__DisplayClass0.
Failed to load type token 69001e5e for the profile data in [C:\Users\Glenn\.k\runtimes\kre-coreclr-win-x86.1.0.0-beta4-11138\bin\Microsoft.C
odeAnalysis.CSharp.dll] The type specified by the IBC data is no longer present in the assembly's metadata.  The type was [Microsoft.CodeAna
lysis]Microsoft.CodeAnalysis.ArrayBuilder`1+<>c__DisplayClass0.
Failed to load type token 69002056 for the profile data in [C:\Users\Glenn\.k\runtimes\kre-coreclr-win-x86.1.0.0-beta4-11138\bin\Microsoft.C
odeAnalysis.CSharp.dll] The type specified by the IBC data is no longer present in the assembly's metadata.  The type was [Microsoft.CodeAna
lysis]Microsoft.CodeAnalysis.ArrayBuilder`1+<>c__DisplayClass0.
Failed to load type token 690021e8 for the profile data in [C:\Users\Glenn\.k\runtimes\kre-coreclr-win-x86.1.0.0-beta4-11138\bin\Microsoft.C
odeAnalysis.CSharp.dll] The type specified by the IBC data is no longer present in the assembly's metadata.  The type was [Microsoft.CodeAna
lysis]Microsoft.CodeAnalysis.ArrayBuilder`1+<>c__DisplayClass0.
Failed to load type token 69002490 for the profile data in [C:\Users\Glenn\.k\runtimes\kre-coreclr-win-x86.1.0.0-beta4-11138\bin\Microsoft.C
odeAnalysis.CSharp.dll] The type specified by the IBC data is no longer present in the assembly's metadata.  The type was [Microsoft.CodeAna
lysis]Microsoft.CodeAnalysis.ArrayBuilder`1+<>c__DisplayClass0.
Failed to load type token 690024fe for the profile data in [C:\Users\Glenn\.k\runtimes\kre-coreclr-win-x86.1.0.0-beta4-11138\bin\Microsoft.C
odeAnalysis.CSharp.dll] The type specified by the IBC data is no longer present in the assembly's metadata.  The type was [Microsoft.CodeAna
lysis]Microsoft.CodeAnalysis.Collections.PooledDictionary`2+<>c__DisplayClass0.

swaggerloaf avatar Feb 25 '15 19:02 swaggerloaf

tested on x64 coreclr with same error as on x86 coreclr so CLR works (x86 and x64) but coreclr does not

c:\projects\2015\NeoSample-ASPNET5-master\src\NeoSample>kvm list
Active Version           Runtime Architecture Location                   Alias
------ -------           ------- ------------ --------                   -----
       1.0.0-beta3       clr     x64          C:\Users\Glenn\.k\runtimes
       1.0.0-beta3       clr     x86          C:\Users\Glenn\.k\runtimes
       1.0.0-beta3       coreclr x64          C:\Users\Glenn\.k\runtimes
       1.0.0-beta3       coreclr x86          C:\Users\Glenn\.k\runtimes
  *    1.0.0-beta4-11138 coreclr x64          C:\Users\Glenn\.k\runtimes default
c:\projects\2015\NeoSample-ASPNET5-master\src\NeoSample>k --version
1.0.0-beta4-11138
c:\projects\2015\NeoSample-ASPNET5-master\src\NeoSample>k ef --version
7.0.0-beta4-12364
c:\projects\2015\NeoSample-ASPNET5-master\src\NeoSample>k ef migration apply  CreateIdentitySchema  -c ApplicationDbContext
Using context 'ApplicationDbContext'.
System.DllNotFoundException: Unable to load DLL 'sni.dll': The specified procedure could not be found. (Exception from HRESUL
   at System.Data.SqlClient.SNINativeMethodWrapper.UnmanagedIsTokenRestricted(IntPtr token, Boolean& isRestricted)
   at System.Data.Win32NativeMethods.IsTokenRestrictedWrapper(IntPtr token)

swaggerloaf avatar Feb 25 '15 20:02 swaggerloaf

@victorhurdugaci has confirmed that this started working correctly in recent builds.

divega avatar Mar 21 '15 13:03 divega

I can reproduce this on RC (Windows 7, sql 2008R2)

An exception of type 'System.DllNotFoundException' occurred in EntityFramework.Core.dll but was not handled in user code

Additional information: Unable to load DLL 'C:\Users\elgin.dnx\packages\System.Data.SqlClient.sni- x86\4.0.0-beta-23019\runtimes\win7-x86\native\sni.dll'

Package.json:

{ "version": "1.0.0-*", "description": "ImportAllerWithdrawsInDB Console Application", "authors": [ "elgin" ], "tags": [ "" ], "projectUrl": "", "licenseUrl": "",

"compilationOptions": { "emitEntryPoint": true },

"dependencies": { "EntityFramework.Core": "7.0.0-rc1-final", "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", "System.Data.SqlClient": "4.0.0-beta-23516", "System.Data.SqlClient.sni-x86": "4.0.0-beta-23019" },

"commands": { "ImportAllerWithdrawsInDB": "ImportAllerWithdrawsInDB" },

"frameworks": {

"dnxcore50": {
  "dependencies": {
    "Microsoft.CSharp": "4.0.1-beta-23516",
    "System.Collections": "4.0.11-beta-23516",
    "System.Console": "4.0.0-beta-23516",
    "System.Linq": "4.0.1-beta-23516",
    "System.Threading": "4.0.11-beta-23516"


  }
}

} }

ostelaymetaule avatar Nov 23 '15 12:11 ostelaymetaule

@ostelaymetaule this is a known issue in RC1 where SQL Client depends on Visual C++ Redistributable for Visual Studio 2012. They are working the resolve the issue. We have https://github.com/aspnet/EntityFramework/issues/3787 tracking the issue on the EF side.

rowanmiller avatar Nov 23 '15 18:11 rowanmiller

I am trying to deploy a website using the coreclr-x64-rc1-update1 on Windows Server 2008 R2.

I've installed both x86 and x64 versions of the Visual C++ Redist for Visual Studio 2012, 2013 & 2015 and I still seem to get the error.

Is there anything else I need to do to get this working?

dontbesorry80 avatar Dec 18 '15 16:12 dontbesorry80

@dontbesorry80 Indeed, same issue here. coreclr-x64-rc1-update1 on Windows Server 2008 R2 with Microsoft Visual C++ 2012 Redistributable installed and the issue persists.

@rowanmiller Do you know of any other workarounds or solutions available yet?

juswes avatar Dec 29 '15 10:12 juswes

@dontbesorry80 @juswes - We have seen some more reports of this occurring on RC1 (beyond the original issues that we fixed - such as this one). Here is the issue we are tracking now https://github.com/aspnet/EntityFramework/issues/4162. No workaround as yet, but we'll keep that thread updated as we investigate (we're catching up on a backlog of issue reports after folks were out for the holidays).

rowanmiller avatar Jan 04 '16 19:01 rowanmiller