SqlClient: "System.Data.SqlClient is not supported on this platform" on .NET 6 on RHEL and AlmaLinux, works fine on .NET 5 and under Ubuntu

Describe the bug

We have a cross platform ASP.NET 6.0 app (published as “portable”) that runs fine on Windows, Ubuntu etc, but throws the above error on RHEL and AlmaLinux. Reverting to the older version of the app that targets .NET 5 works fine.

Both versions System.Data.SqlClient 4.8.3 and Microsoft.Data.SqlClient throw this error. My connection-string uses an SQL user with a password, not using Kerberos or windows-integrated authentication.

System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform.
at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString)

To reproduce

Create a .NET Core 6.0 app that references SqlClient, publish, deploy to RHEL, run with dotnet MyProject.dll

THIS IS TRIVIALLY REPRODUCABLE on AlmaLinux 8 under WSL2 (available in MS Store). But it works fine under Ubuntu under WSL2.

Install WSL2, install Almalinux 8 from MS Store, run sudo yum install dotnet-sdk-6.0 -y to install dotnet, then run the app using dotnet MyProject.dll

Almalinux dotnet–info output:

.NET SDK (reflecting any global.json):
 Version:   6.0.105
 Commit:    679e7e16e1

Runtime Environment:
 OS Name:     almalinux
 OS Version:  8.5
 OS Platform: Linux
 RID:         rhel.8-x64
 Base Path:   /usr/lib64/dotnet/sdk/6.0.105/

Host (useful for support):
  Version: 6.0.5
  Commit:  70ae3df4a6

.NET SDKs installed:
  6.0.105 [/usr/lib64/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.5 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.5 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download```

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 54 (23 by maintainers)

Most upvoted comments

closing this as it’s not an issue with the Microsoft.Data.SqlClient client package.

Anyone solved this on Pop!_OS 22.04?

EDIT: Solved installing the dotnet SDK manually and setting the path manually on Rider.

image https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.401-linux-x64-binaries image

With @omajid suggestion, I was able to change the Microsoft.NETCore.App.deps.json so I can use SQLClient without having to install the binary version and playing around with paths First I went to download the .NET 6 binaries from here: https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.401-linux-x64-binaries

Extract the archive and go to ./shared/Microsoft.NETCore.App/6.x.x/Microsoft.NETCore.App.deps.json Copy all of the data inside the “runtimes” section. In my case, it will look like this "runtimes": { "alpine-x64": [ "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.10-x64": [ "alpine.3.10", "alpine.3.9-x64", "alpine.3.9", "alpine.3.8-x64", "alpine.3.8", "alpine.3.7-x64", "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.11-x64": [ "alpine.3.11", "alpine.3.10-x64", "alpine.3.10", "alpine.3.9-x64", "alpine.3.9", "alpine.3.8-x64", "alpine.3.8", "alpine.3.7-x64", "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.12-x64": [ "alpine.3.12", "alpine.3.11-x64", "alpine.3.11", "alpine.3.10-x64", "alpine.3.10", "alpine.3.9-x64", "alpine.3.9", "alpine.3.8-x64", "alpine.3.8", "alpine.3.7-x64", "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.13-x64": [ "alpine.3.13", "alpine.3.12-x64", "alpine.3.12", "alpine.3.11-x64", "alpine.3.11", "alpine.3.10-x64", "alpine.3.10", "alpine.3.9-x64", "alpine.3.9", "alpine.3.8-x64", "alpine.3.8", "alpine.3.7-x64", "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.14-x64": [ "alpine.3.14", "alpine.3.13-x64", "alpine.3.13", "alpine.3.12-x64", "alpine.3.12", "alpine.3.11-x64", "alpine.3.11", "alpine.3.10-x64", "alpine.3.10", "alpine.3.9-x64", "alpine.3.9", "alpine.3.8-x64", "alpine.3.8", "alpine.3.7-x64", "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.15-x64": [ "alpine.3.15", "alpine.3.14-x64", "alpine.3.14", "alpine.3.13-x64", "alpine.3.13", "alpine.3.12-x64", "alpine.3.12", "alpine.3.11-x64", "alpine.3.11", "alpine.3.10-x64", "alpine.3.10", "alpine.3.9-x64", "alpine.3.9", "alpine.3.8-x64", "alpine.3.8", "alpine.3.7-x64", "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.16-x64": [ "alpine.3.16", "alpine.3.15-x64", "alpine.3.15", "alpine.3.14-x64", "alpine.3.14", "alpine.3.13-x64", "alpine.3.13", "alpine.3.12-x64", "alpine.3.12", "alpine.3.11-x64", "alpine.3.11", "alpine.3.10-x64", "alpine.3.10", "alpine.3.9-x64", "alpine.3.9", "alpine.3.8-x64", "alpine.3.8", "alpine.3.7-x64", "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.6-x64": [ "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.7-x64": [ "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.8-x64": [ "alpine.3.8", "alpine.3.7-x64", "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "alpine.3.9-x64": [ "alpine.3.9", "alpine.3.8-x64", "alpine.3.8", "alpine.3.7-x64", "alpine.3.7", "alpine.3.6-x64", "alpine.3.6", "alpine-x64", "alpine", "linux-musl-x64", "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android-x64": [ "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.21-x64": [ "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.22-x64": [ "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.23-x64": [ "android.23", "android.22-x64", "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.24-x64": [ "android.24", "android.23-x64", "android.23", "android.22-x64", "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.25-x64": [ "android.25", "android.24-x64", "android.24", "android.23-x64", "android.23", "android.22-x64", "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.26-x64": [ "android.26", "android.25-x64", "android.25", "android.24-x64", "android.24", "android.23-x64", "android.23", "android.22-x64", "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.27-x64": [ "android.27", "android.26-x64", "android.26", "android.25-x64", "android.25", "android.24-x64", "android.24", "android.23-x64", "android.23", "android.22-x64", "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.28-x64": [ "android.28", "android.27-x64", "android.27", "android.26-x64", "android.26", "android.25-x64", "android.25", "android.24-x64", "android.24", "android.23-x64", "android.23", "android.22-x64", "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.29-x64": [ "android.29", "android.28-x64", "android.28", "android.27-x64", "android.27", "android.26-x64", "android.26", "android.25-x64", "android.25", "android.24-x64", "android.24", "android.23-x64", "android.23", "android.22-x64", "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.30-x64": [ "android.30", "android.29-x64", "android.29", "android.28-x64", "android.28", "android.27-x64", "android.27", "android.26-x64", "android.26", "android.25-x64", "android.25", "android.24-x64", "android.24", "android.23-x64", "android.23", "android.22-x64", "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "android.31-x64": [ "android.31", "android.30-x64", "android.30", "android.29-x64", "android.29", "android.28-x64", "android.28", "android.27-x64", "android.27", "android.26-x64", "android.26", "android.25-x64", "android.25", "android.24-x64", "android.24", "android.23-x64", "android.23", "android.22-x64", "android.22", "android.21-x64", "android.21", "android-x64", "android", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "arch-x64": [ "arch", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "centos-x64": [ "centos", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "centos.7-x64": [ "centos.7", "centos-x64", "rhel.7-x64", "centos", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "centos.8-x64": [ "centos.8", "centos-x64", "rhel.8-x64", "centos", "rhel.8", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "centos.9-x64": [ "centos.9", "centos-x64", "rhel.9-x64", "centos", "rhel.9", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "debian-x64": [ "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "debian.10-x64": [ "debian.10", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "debian.11-x64": [ "debian.11", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "debian.8-x64": [ "debian.8", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "debian.9-x64": [ "debian.9", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "exherbo-x64": [ "exherbo", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora-x64": [ "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.23-x64": [ "fedora.23", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.24-x64": [ "fedora.24", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.25-x64": [ "fedora.25", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.26-x64": [ "fedora.26", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.27-x64": [ "fedora.27", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.28-x64": [ "fedora.28", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.29-x64": [ "fedora.29", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.30-x64": [ "fedora.30", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.31-x64": [ "fedora.31", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.32-x64": [ "fedora.32", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.33-x64": [ "fedora.33", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.34-x64": [ "fedora.34", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.35-x64": [ "fedora.35", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.36-x64": [ "fedora.36", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "fedora.37-x64": [ "fedora.37", "fedora-x64", "fedora", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "gentoo-x64": [ "gentoo", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linux-musl-x64": [ "linux-musl", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linux-x64": [ "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.17-x64": [ "linuxmint.17", "ubuntu.14.04-x64", "ubuntu.14.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.17.1-x64": [ "linuxmint.17.1", "linuxmint.17-x64", "linuxmint.17", "ubuntu.14.04-x64", "ubuntu.14.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.17.2-x64": [ "linuxmint.17.2", "linuxmint.17.1-x64", "linuxmint.17.1", "linuxmint.17-x64", "linuxmint.17", "ubuntu.14.04-x64", "ubuntu.14.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.17.3-x64": [ "linuxmint.17.3", "linuxmint.17.2-x64", "linuxmint.17.2", "linuxmint.17.1-x64", "linuxmint.17.1", "linuxmint.17-x64", "linuxmint.17", "ubuntu.14.04-x64", "ubuntu.14.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.18-x64": [ "linuxmint.18", "ubuntu.16.04-x64", "ubuntu.16.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.18.1-x64": [ "linuxmint.18.1", "linuxmint.18-x64", "linuxmint.18", "ubuntu.16.04-x64", "ubuntu.16.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.18.2-x64": [ "linuxmint.18.2", "linuxmint.18.1-x64", "linuxmint.18.1", "linuxmint.18-x64", "linuxmint.18", "ubuntu.16.04-x64", "ubuntu.16.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.18.3-x64": [ "linuxmint.18.3", "linuxmint.18.2-x64", "linuxmint.18.2", "linuxmint.18.1-x64", "linuxmint.18.1", "linuxmint.18-x64", "linuxmint.18", "ubuntu.16.04-x64", "ubuntu.16.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.19-x64": [ "linuxmint.19", "ubuntu.18.04-x64", "ubuntu.18.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.19.1-x64": [ "linuxmint.19.1", "linuxmint.19-x64", "linuxmint.19", "ubuntu.18.04-x64", "ubuntu.18.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "linuxmint.19.2-x64": [ "linuxmint.19.2", "linuxmint.19.1-x64", "linuxmint.19.1", "linuxmint.19-x64", "linuxmint.19", "ubuntu.18.04-x64", "ubuntu.18.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol-x64": [ "ol", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.7-x64": [ "ol.7", "ol-x64", "rhel.7-x64", "ol", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.7.0-x64": [ "ol.7.0", "ol.7-x64", "rhel.7.0-x64", "ol.7", "rhel.7.0", "ol-x64", "rhel.7-x64", "ol", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.7.1-x64": [ "ol.7.1", "ol.7.0-x64", "rhel.7.1-x64", "ol.7.0", "rhel.7.1", "ol.7-x64", "rhel.7.0-x64", "ol.7", "rhel.7.0", "ol-x64", "rhel.7-x64", "ol", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.7.2-x64": [ "ol.7.2", "ol.7.1-x64", "rhel.7.2-x64", "ol.7.1", "rhel.7.2", "ol.7.0-x64", "rhel.7.1-x64", "ol.7.0", "rhel.7.1", "ol.7-x64", "rhel.7.0-x64", "ol.7", "rhel.7.0", "ol-x64", "rhel.7-x64", "ol", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.7.3-x64": [ "ol.7.3", "ol.7.2-x64", "rhel.7.3-x64", "ol.7.2", "rhel.7.3", "ol.7.1-x64", "rhel.7.2-x64", "ol.7.1", "rhel.7.2", "ol.7.0-x64", "rhel.7.1-x64", "ol.7.0", "rhel.7.1", "ol.7-x64", "rhel.7.0-x64", "ol.7", "rhel.7.0", "ol-x64", "rhel.7-x64", "ol", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.7.4-x64": [ "ol.7.4", "ol.7.3-x64", "rhel.7.4-x64", "ol.7.3", "rhel.7.4", "ol.7.2-x64", "rhel.7.3-x64", "ol.7.2", "rhel.7.3", "ol.7.1-x64", "rhel.7.2-x64", "ol.7.1", "rhel.7.2", "ol.7.0-x64", "rhel.7.1-x64", "ol.7.0", "rhel.7.1", "ol.7-x64", "rhel.7.0-x64", "ol.7", "rhel.7.0", "ol-x64", "rhel.7-x64", "ol", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.7.5-x64": [ "ol.7.5", "ol.7.4-x64", "rhel.7.5-x64", "ol.7.4", "rhel.7.5", "ol.7.3-x64", "rhel.7.4-x64", "ol.7.3", "rhel.7.4", "ol.7.2-x64", "rhel.7.3-x64", "ol.7.2", "rhel.7.3", "ol.7.1-x64", "rhel.7.2-x64", "ol.7.1", "rhel.7.2", "ol.7.0-x64", "rhel.7.1-x64", "ol.7.0", "rhel.7.1", "ol.7-x64", "rhel.7.0-x64", "ol.7", "rhel.7.0", "ol-x64", "rhel.7-x64", "ol", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.7.6-x64": [ "ol.7.6", "ol.7.5-x64", "rhel.7.6-x64", "ol.7.5", "rhel.7.6", "ol.7.4-x64", "rhel.7.5-x64", "ol.7.4", "rhel.7.5", "ol.7.3-x64", "rhel.7.4-x64", "ol.7.3", "rhel.7.4", "ol.7.2-x64", "rhel.7.3-x64", "ol.7.2", "rhel.7.3", "ol.7.1-x64", "rhel.7.2-x64", "ol.7.1", "rhel.7.2", "ol.7.0-x64", "rhel.7.1-x64", "ol.7.0", "rhel.7.1", "ol.7-x64", "rhel.7.0-x64", "ol.7", "rhel.7.0", "ol-x64", "rhel.7-x64", "ol", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.8-x64": [ "ol.8", "ol-x64", "rhel.8-x64", "ol", "rhel.8", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ol.8.0-x64": [ "ol.8.0", "ol.8-x64", "rhel.8.0-x64", "ol.8", "rhel.8.0", "ol-x64", "rhel.8-x64", "ol", "rhel.8", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "opensuse-x64": [ "opensuse", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "opensuse.13.2-x64": [ "opensuse.13.2", "opensuse-x64", "opensuse", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "opensuse.15.0-x64": [ "opensuse.15.0", "opensuse-x64", "opensuse", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "opensuse.15.1-x64": [ "opensuse.15.1", "opensuse-x64", "opensuse", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "opensuse.42.1-x64": [ "opensuse.42.1", "opensuse-x64", "opensuse", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "opensuse.42.2-x64": [ "opensuse.42.2", "opensuse-x64", "opensuse", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "opensuse.42.3-x64": [ "opensuse.42.3", "opensuse-x64", "opensuse", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel-x64": [ "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.6-x64": [ "rhel.6", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.7-x64": [ "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.7.0-x64": [ "rhel.7.0", "rhel.7-x64", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.7.1-x64": [ "rhel.7.1", "rhel.7.0-x64", "rhel.7.0", "rhel.7-x64", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.7.2-x64": [ "rhel.7.2", "rhel.7.1-x64", "rhel.7.1", "rhel.7.0-x64", "rhel.7.0", "rhel.7-x64", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.7.3-x64": [ "rhel.7.3", "rhel.7.2-x64", "rhel.7.2", "rhel.7.1-x64", "rhel.7.1", "rhel.7.0-x64", "rhel.7.0", "rhel.7-x64", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.7.4-x64": [ "rhel.7.4", "rhel.7.3-x64", "rhel.7.3", "rhel.7.2-x64", "rhel.7.2", "rhel.7.1-x64", "rhel.7.1", "rhel.7.0-x64", "rhel.7.0", "rhel.7-x64", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.7.5-x64": [ "rhel.7.5", "rhel.7.4-x64", "rhel.7.4", "rhel.7.3-x64", "rhel.7.3", "rhel.7.2-x64", "rhel.7.2", "rhel.7.1-x64", "rhel.7.1", "rhel.7.0-x64", "rhel.7.0", "rhel.7-x64", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.7.6-x64": [ "rhel.7.6", "rhel.7.5-x64", "rhel.7.5", "rhel.7.4-x64", "rhel.7.4", "rhel.7.3-x64", "rhel.7.3", "rhel.7.2-x64", "rhel.7.2", "rhel.7.1-x64", "rhel.7.1", "rhel.7.0-x64", "rhel.7.0", "rhel.7-x64", "rhel.7", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.8-x64": [ "rhel.8", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.8.0-x64": [ "rhel.8.0", "rhel.8-x64", "rhel.8", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.8.1-x64": [ "rhel.8.1", "rhel.8.0-x64", "rhel.8.0", "rhel.8-x64", "rhel.8", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "rhel.9-x64": [ "rhel.9", "rhel-x64", "rhel", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "sles-x64": [ "sles", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "sles.12-x64": [ "sles.12", "sles-x64", "sles", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "sles.12.1-x64": [ "sles.12.1", "sles.12-x64", "sles.12", "sles-x64", "sles", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "sles.12.2-x64": [ "sles.12.2", "sles.12.1-x64", "sles.12.1", "sles.12-x64", "sles.12", "sles-x64", "sles", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "sles.12.3-x64": [ "sles.12.3", "sles.12.2-x64", "sles.12.2", "sles.12.1-x64", "sles.12.1", "sles.12-x64", "sles.12", "sles-x64", "sles", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "sles.12.4-x64": [ "sles.12.4", "sles.12.3-x64", "sles.12.3", "sles.12.2-x64", "sles.12.2", "sles.12.1-x64", "sles.12.1", "sles.12-x64", "sles.12", "sles-x64", "sles", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "sles.15-x64": [ "sles.15", "sles.12.4-x64", "sles.12.4", "sles.12.3-x64", "sles.12.3", "sles.12.2-x64", "sles.12.2", "sles.12.1-x64", "sles.12.1", "sles.12-x64", "sles.12", "sles-x64", "sles", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "sles.15.1-x64": [ "sles.15.1", "sles.15-x64", "sles.15", "sles.12.4-x64", "sles.12.4", "sles.12.3-x64", "sles.12.3", "sles.12.2-x64", "sles.12.2", "sles.12.1-x64", "sles.12.1", "sles.12-x64", "sles.12", "sles-x64", "sles", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu-x64": [ "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.14.04-x64": [ "ubuntu.14.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.14.10-x64": [ "ubuntu.14.10", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.15.04-x64": [ "ubuntu.15.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.15.10-x64": [ "ubuntu.15.10", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.16.04-x64": [ "ubuntu.16.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.16.10-x64": [ "ubuntu.16.10", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.17.04-x64": [ "ubuntu.17.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.17.10-x64": [ "ubuntu.17.10", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.18.04-x64": [ "ubuntu.18.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.18.10-x64": [ "ubuntu.18.10", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.19.04-x64": [ "ubuntu.19.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.19.10-x64": [ "ubuntu.19.10", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.20.04-x64": [ "ubuntu.20.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.20.10-x64": [ "ubuntu.20.10", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.21.04-x64": [ "ubuntu.21.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.21.10-x64": [ "ubuntu.21.10", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ], "ubuntu.22.04-x64": [ "ubuntu.22.04", "ubuntu-x64", "ubuntu", "debian-x64", "debian", "linux-x64", "linux", "unix-x64", "unix", "any", "base" ] }

Go to your deps.json file on your OS, which in /usr/lib/dotnet/shared/Microsoft.NETCore.App/6.x.x/Microsoft.NETCore.App.deps.json You will need sudo permission able to edit the file Replace the “runtimes” section with things you copied in your clipboard.

Be aware that this is not 100% sure SQLClient will working probably after this.

So I’ve been working on this problem for a little bit and here is what I’ve encountered

  1. Installing apt install dotnet6 causes the problem
  2. The solution provided by @mruf https://github.com/dotnet/SqlClient/issues/1643#issuecomment-1223716988 did not work for me
  3. **Manually installing the SDK into a folder from the dot.net downloads page and changing my /usr/bin/dotnet symbolic link path to that custom folder did resolve the problem… BUT

Example sudo ln -s /usr/lib/dotnet/custom/dotnet /usr/bin/dotnet

**Step 3 introduced a new bug/problem. I was able to get the application to startup and run but noticed that several of my EF Core queries stopped returning data. Even though the logged query should have returned something.

**[EDIT] Upon further inspection my PC is set to EST and the date was suppose to be UTC and it made a conversion which is why the query returned different reuslts. This is likely my bug. Step 3 is the winner

  1. Running the application using a docker container referencing image mcr.microsoft.com/dotnet/sdk:6.0-jammy does work fine. Which confuses me because I am on the same version of Ubuntu (POP_OS!)

I got it working by doing the following (based on steps from here: https://github.com/dotnet/core/issues/7699)

  1. sudo apt remove dotnet*
  2. sudo apt remove aspnetcore*
  3. Create file: sudo touch /etc/apt/preferences
  4. Add the following contents to the file:

Package: * Pin: origin “packages.microsoft.com” Pin-Priority: 1001

  1. sudo apt install dotnet-sdk-6.0

This will install a newer SDK version (6.0.400 [/usr/share/dotnet/sdk]) which apparently solves this problem.

I’m building a WM with nested virtualization enabled so I can setup all the stuff needed for wsl2 debugging. If it was a simple fix I wouldn’t need to do that. So yes I imagine you’re right that we’re all dragging this out but it’s because it’s not a trivial thing to setup debugging for.

I’m getting this issue with PopOS 22 ( which is based on ubuntu I believe ). I specify the RID and it still appears. All my other code works fine except for this SqlClient package.

@Wraith2 Like you suggested I tried creating an issue with the nuget team, but they said the problem is with SqlClient, not nuget (see their response in the linked issue)

Again, to recap:

  • some (!) linux distros throw this error (AlmaLinux, Rocky Linux, RedHat)
  • this worked fine in .NET 5

Any news regarding this issue? SqlClient is currently unusable on Linux.

@alex-jitbit can you still reproduce this on RHEL 8 (not Alma)? Do you have a complete project I can copy and run?


My understanding is that this is an issue in how a source-built .NET (that is, the version included in Linux distro repositories, not the Microsoft-built .NET) can have a broken Runtime Identifer (RID) graph, or a bug in how the RID itself is computed.

That results in .NET being unable to navigate the RID graph to go from “This is distro $foo” (eg, the RID almalinux.8-x64) to “This is a Linux/Unix OS” (the RID unix). Microsoft.Data.SqlClient is shipped in a couple of variants: unix and windows. If the .NET runtime can’t do a fallback from your system’s RID to unix or windows, it uses the non-OS System.Data.SqlClient, which is essentially empty and just prints errors.

This is also why something like <Exec Command="cp $(OutDir)runtimes/unix/lib/netcoreapp3.1/System.Data.SqlClient.dll $(OutDir)" /> works: it tells .NET to use the System.Data.SqlClient for the unix RID directly without asking your .NET runtime to resolve your OS’s RID.

To see if your .NET runtime is affected by the bug, compare the OS Name/OS Version/RID values from dotnet --info with the runtimes property in your .NET runtime’s shared/Microsoft.NETCore.App/$VERSION/Microsoft.NETCore.App.deps.json file.

For example, on RHEL 8, the RID values look consistent and appear in the RID fallback graph in the Microsoft.NETCore.App.deps.json file. System.Data.SqlClient should work here.

# dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.113
 Commit:    4a23b50f97

Runtime Environment:
 OS Name:     rhel
 OS Version:  8
 OS Platform: Linux
 RID:         rhel.8-x64
 Base Path:   /usr/lib64/dotnet/sdk/6.0.113/
...
# jq '.runtimes' /usr/lib64/dotnet/shared/Microsoft.NETCore.App/6.0.13/Microsoft.NETCore.App.deps.json 
{            
  "centos.8-x64": [
    "centos.8",
    "centos-x64",
    "rhel.8-x64",
    "centos",
    "rhel.8",   
    "rhel-x64",
    "rhel",    
    "linux-x64",
    "linux",
    "unix-x64",
    "unix",
    "any",       
    "base"   
  ],           
  "ol.8-x64": [
    "ol.8",     
    "ol-x64",
    "rhel.8-x64",
    "ol",  
    "rhel.8",
    "rhel-x64",
    "rhel",
    "linux-x64",   
    "linux",   
    "unix-x64",  
    "unix",  
    "any",     
    "base" 
  ],            
  "ol.8.0-x64": [
    "ol.8.0",  
    "ol.8-x64",
    "rhel.8.0-x64",
    "ol.8",
    "rhel.8.0",
    "ol-x64",      
    "rhel.8-x64",
    "ol",          
    "rhel.8",  
    "rhel-x64",  
    "rhel",  
    "linux-x64",
    "linux",
    "unix-x64", 
    "unix", 
    "any",     
    "base" 
  ],  
  "rhel.8-x64": [
    "rhel.8",
    "rhel-x64",
    "rhel",
    "linux-x64",
    "linux",
    "unix-x64",
    "unix",
    "any",
    "base"
  ],
  "rhel.8.0-x64": [
    "rhel.8.0",
    "rhel.8-x64",
    "rhel.8",
    "rhel-x64",
    "rhel",
    "linux-x64",
    "linux",
    "unix-x64",
    "unix",
    "any",
    "base"
  ],
  "rhel.8.1-x64": [
    "rhel.8.1",
    "rhel.8.0-x64",
    "rhel.8.0",
    "rhel.8-x64",
    "rhel.8",
    "rhel-x64",
    "rhel",
    "linux-x64",
    "linux",
    "unix-x64",
    "unix",
    "any",
    "base"
  ],
  "rocky.8-x64": [
    "rocky.8",
    "rocky-x64",
    "rhel.8-x64",
    "rocky",
    "rhel.8",
    "rhel-x64",
    "rhel",
    "linux-x64",
    "linux",
    "unix-x64",
    "unix",
    "any",
    "base"
  ]
}

Compare that with alpine:edge which is known to be broken (https://github.com/dotnet/runtime/issues/73525). In this case, the OS Version and RID in dotnet --info don’t match:

/ # dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.113
 Commit:    4a23b50f97

Runtime Environment:
 OS Name:     alpine
 OS Version:  3.17_alpha20221110
 OS Platform: Linux
 RID:         alpine.3.17-x64
 Base Path:   /usr/lib/dotnet/sdk/6.0.113/
...
/ # jq '.runtimes' /usr/lib/dotnet/shared/Microsoft.NETCore.App/6.0.13/Microsoft.NETCore.App.deps.json 
{
  "alpine.3.17-x64": [
    "alpine.3.17",
    "alpine.3.16-x64",
    "alpine.3.16",
    "alpine.3.15-x64",
    "alpine.3.15",
    "alpine.3.14-x64",
    "alpine.3.14",
    "alpine.3.13-x64",
    "alpine.3.13",
    "alpine.3.12-x64",
    "alpine.3.12",
    "alpine.3.11-x64",
    "alpine.3.11",
    "alpine.3.10-x64",
    "alpine.3.10",
    "alpine.3.9-x64",
    "alpine.3.9",
    "alpine.3.8-x64",
    "alpine.3.8",
    "alpine.3.7-x64",
    "alpine.3.7",
    "alpine.3.6-x64",
    "alpine.3.6",
    "alpine-x64",
    "alpine",
    "linux-musl-x64",
    "linux-musl",
    "linux-x64",
    "linux",
    "unix-x64",
    "unix",
    "any",
    "base"
  ]
}

closing this as it’s not an issue with the Microsoft.Data.SqlClient client package.

Does anyone have a link to another bug report? I’m not sure I understand the problem correctly, and I can’t find out where to go to follow up on this issue.

I have the same issue after updating to the latest version of PopOS 22.04:

System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform

Microsoft.Data.SqlClient is the latest version 5.0.0.

Here’s my SDK and runtime versions:

6.0.108 [/usr/lib/dotnet/dotnet6-6.0.108/sdk]

Microsoft.AspNetCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.NETCore.App]

@Wraith2 appreciate

I would try it with the latest .NET 6 servicing release first.

I was able to bypass this issue by putting all of EFCore (and Microsoft.Data.SqlClient) into generic linux-* rids and then manually installing them via extraction from tar.gz files into the $DOTNET_ROOT this resulted in when I tried to run my discord bot in it working on all linux based OS’s because I used the generic linux based RIDs for them (and it with r2r).

Also doing such bypass as an experiment also allowed me to be able to roll forward new updates to efcore to the discord bot without needing to rebuild which for me is a bonus because of servicing releases being considered critical for me (also the fact that rebuilding can be a nightmare).

I believe the issue may be related to missing RIDs, such as for Rocky Linux, in the runtime. I’ve opened PR dotnet/runtime#74164 for Rocky Linux on the 6.0 servicing line.

It is usable under some Linux, just not the specific one that you want to use. We need to know why the nuget restore process isn’t identifying your distro as Linux and that isn’t something that is part of this library. You may need to open an issue on nuget and get their help.

I have just installed the latest aspnetcore 6.0.6 runtime, which is the latest servicing release, and have the same exact error.

It really feels like you guys are just dragging the issue. Meanwhile almost a dozen of our customers are waiting for a fix.

P.S. do I really need the SDK installed to run apps though? Isn’t the runtime enough? I spent an hour trying to find a way to install the “latest SDK” on RHEL/Alma/etc, and MS website does not describe any info. If you really want me to - please provide the instructions. https://docs.microsoft.com/en-us/dotnet/core/install/linux-rhel - is not very helpful.

@Wraith2 just tried with Microsoft.Data.SqlClient

! SAME ERROR !
System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform.
: at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString)