Skip to content
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

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

Open
xs2bharat opened this issue Jun 12, 2024 · 5 comments
Labels
area-System.Data.SqlClient untriaged New issue has not been triaged by the area owner

Comments

@xs2bharat
Copy link

Describe the bug

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

Exception message:System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform.
Stack trace: System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform.
   at Microsoft.Data.SqlClient.SqlConnectionStringBuilder..ctor(String connectionString)

To reproduce

Use Microsoft.Data.SqlClient" Version="5.2.1" in mcr.microsoft.com/dotnet/aspnet:6.0.28-alpine3.19 image
"ConnectionString": "Server=tcp:xxxxxxx.database.windows.net;Initial Catalog=XXXXXXX;Connection Timeout=50"

var sqlConnectionBuilder = new SqlConnectionStringBuilder(this.connectionString)
{
    UserID = this.settings.DatabaseUsername,
    Password = this.databasePassword
};

Expected behavior

Successful connection should be created

Further technical details

Microsoft.Data.SqlClient version: 5.2.1
.NET target: net6.0
SQL Server version: Azure SQL Database Managed Instance, Windows Server 2022 Datacenter (10.0)
Operating system: Docker container - mcr.microsoft.com/dotnet/aspnet:6.0.28-alpine3.19

Additional context
Add any other context about the problem here.

@dauinsight
Copy link

Can you confirm if this occurs on other versions of SqlClient?

Can you also try explicitly setting the runtime id as discussed in this thread: dotnet/SqlClient#2030 (comment)

@dauinsight dauinsight added the untriaged New issue has not been triaged by the area owner label Jun 12, 2024
@xs2bharat
Copy link
Author

Issue is fixed when switched to docker image mcr.microsoft.com/dotnet/aspnet:6.0.28-alpine3.18

@kf-gonzalez2 kf-gonzalez2 removed the untriaged New issue has not been triaged by the area owner label Jun 18, 2024
@kf-gonzalez2
Copy link

It might be an issue in the .Net platform detection logic not detecting alpine 3.19 as linux.

@JRahnama JRahnama transferred this issue from dotnet/SqlClient Jun 18, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jun 18, 2024
Copy link
Contributor

Tagging subscribers to this area: @DavoudEshtehari, @David-Engel, @JRahnama
See info in area-owners.md if you want to be subscribed.

@ErikEJ
Copy link

ErikEJ commented Jun 18, 2024

Maybe dotnet/dotnet-docker#5243 is related?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Data.SqlClient untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

4 participants