-
Notifications
You must be signed in to change notification settings - Fork 5k
SqlClient fails with netcoreapp2.0 on Win7/Server2008 #21116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
sni.dll should be getting pulled down from nuget. Is that DLL present in your nuget/packages directiory? |
Which package to look for? |
More detailed repro details: using System;
using System.Data.SqlClient;
namespace repor
{
class Program
{
static void Main(string[] args)
{
var connectionString =
@"Data Source=(localdb)\MSSQLLocalDB;Database=master;Connect Timeout=30";
using (var connection = new SqlConnection(connectionString))
{
connection.Open();
Console.WriteLine("ServerVersion: {0}", connection.ServerVersion);
Console.WriteLine("State: {0}", connection.State);
}
Console.WriteLine("Hello World!");
}
}
} csproj <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.3.0" />
</ItemGroup>
</Project> Output
|
This is blocking ASP.NET builds. |
sni.dll should be coming from https://www.nuget.org/packages/runtime.win7-x64.runtime.native.System.Data.SqlClient.sni. Can you check the assets file to make sure that it is correctly getting picked up from the tooling? |
CC @davidfowl |
To update this issue. It was discovered the problem is that sni.dll depends on api-sets on Win7 and those are no longer included in .NET Core 2.0 shared framework. So to make this scenario work you either need to directly reference https://www.nuget.org/packages/runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets/ to get the api-set shims or reference the newer version of SqlClient package (>4.4.0). |
….0 on Win7/Server2008" - https://github.com/dotnet/corefx/issues/18406 - Revert when `$(CoreFxVersion)` is upgraded to `4.4.0-*`
….0 on Win7/Server2008" - https://github.com/dotnet/corefx/issues/18406 - Revert when `$(CoreFxVersion)` is upgraded to `4.4.0-*`
….0 on Win7/Server2008" - https://github.com/dotnet/corefx/issues/18406 - Revert when `$(CoreFxVersion)` is upgraded to `4.4.0-*`
….0 on Win7/Server2008" - https://github.com/dotnet/corefx/issues/18406 - Revert when `$(CoreFxVersion)` is upgraded to `4.4.0-*`
….0 on Win7/Server2008" - https://github.com/dotnet/corefx/issues/18406 - Revert when `$(CoreFxVersion)` is upgraded to `4.4.0-*`
….0 on Win7/Server2008" - https://github.com/dotnet/corefx/issues/18406 - Revert when `$(CoreFxVersion)` is upgraded to `4.4.0-*`
- Addresses "SqlClient fails with netcoreapp2.0 on Win7/Server2008" (https://github.com/dotnet/corefx/issues/18406) - Revert if and when $(CoreFxVersion) is upgraded to 4.4.0-*
- Addresses "SqlClient fails with netcoreapp2.0 on Win7/Server2008" (https://github.com/dotnet/corefx/issues/18406) - Revert if and when $(CoreFxVersion) is upgraded to 4.4.0-*
- Addresses "SqlClient fails with netcoreapp2.0 on Win7/Server2008" (https://github.com/dotnet/corefx/issues/18406) - Revert if and when $(CoreFxVersion) is upgraded to 4.4.0-*
- Addresses "SqlClient fails with netcoreapp2.0 on Win7/Server2008" (https://github.com/dotnet/corefx/issues/18406) - Revert if and when $(CoreFxVersion) is upgraded to 4.4.0-*
- Addresses "SqlClient fails with netcoreapp2.0 on Win7/Server2008" (https://github.com/dotnet/corefx/issues/18406) - Revert if and when $(CoreFxVersion) is upgraded to 4.4.0-*
- Addresses "SqlClient fails with netcoreapp2.0 on Win7/Server2008" (dotnet/corefx#18406) - Revert if and when $(CoreFxVersion) is upgraded to 4.4.0-*
- Addresses "SqlClient fails with netcoreapp2.0 on Win7/Server2008" (dotnet/corefx#18406) - Revert if and when $(CoreFxVersion) is upgraded to 4.4.0-*
Using dapper 1.50.2, which has a dependency on SqlClient 4.1, caused this issue. Explicitly installing SqlClient 4.4 indeed solved the issue. |
@twDuke This applies to ServiceStack.OrmLite.SqlServer aswell, explicitly installing 4.4 fixes things! |
Same issue with NPoco v3.8.0 - manually adding System.Data.SqlClient as a nuget package (v4.4.0) fixed it for me as well. Minor note: I only had the error during deploy to Azure and not when debugging on localhost. |
I have an ASP .NET Core MVC project that is getting this error. Are you saying I need to simply install the PM> Install-Package System.Data.SqlClient -version 4.4.0 Is this what I need to do to avoid the above described exception? |
I had the same sni.dll error. Installing System.Data.SqlClient (I installed 4.4.2) worked to fix the problem. @geschw66 Did installing the package fix the issue for you? |
.net core 2.1, System.Data.SqlClient 4.6.1 meet the same issue. After install Microsoft.AspNetCore.All 2.1.11 fixed the issue. |
@besley Good to know. BTW, please be aware that from dotnet core 2.2 and higher, the Microsoft.AspNetCore.All package doesn't include System.Data.SqlClient anymore. This means from v2.2+ and higher. Should you upgrade in the future to that version, you still need to manually reference System.Data.SqlClient in that case. Also the Microsoft.AspNetCore.All is quite a big package. If you don't have a direct need for it, it's best to not reference all the stuff in there. |
Repro steps:
Build https://github.com/aspnet/EntityFramework on windows 7 machine. All tests which uses SqlServer fails. (Tests uses localdb). Same passes in windows10/Server 2012 machines.
Exception message:
dotnet info
cc: @Eilon
The text was updated successfully, but these errors were encountered: