Skip to content

System.Data.SqlClient 4.4.0-preview1 doesn't support RIDs win-x64 or win-x86 #21437

@mikeharder

Description

@mikeharder

Repro Steps

  1. Install SDK 2.0.0-preview1-005899
  2. Create app using files below
  3. dotnet restore
  4. dotnet publish -f netcoreapp2.0 -r win-x64
  5. bin\Debug\netcoreapp2.0\win-x64\Repro.exe
Unhandled 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 'sni.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at System.Data.SqlClient.SNINativeMethodWrapper.SNIInitialize(IntPtr pmo)
  1. dotnet publish -f netcoreapp2.0 -r win7-x64
  2. bin\Debug\netcoreapp2.0\win7-x64\Repro.exe (works as expected)
  3. I assume win-x86 has the same issue, though I haven't tested.

Program.cs

using System;
using System.Data.SqlClient;

namespace Repro
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var connection = new SqlConnection(@"Data Source=(localdb)\MSSQLLocalDB;Database=master;Connect Timeout=30"))
            {
                connection.Open();
                Console.WriteLine("ServerVersion: {0}", connection.ServerVersion);
            }
        }
    }
}

Repro.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeIdentifiers>win-x64;win7-x64</RuntimeIdentifiers>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="System.Data.SqlClient" Version="4.4.0-preview1-25228-03" />
  </ItemGroup>

</Project>

NuGet.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
  </packageSources>
</configuration>

Metadata

Metadata

Assignees

Labels

area-System.Data.SqlClientblockingMarks issues that we want to fast track in order to unblock other important workbug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions