Description
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```