jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM
Other
857 stars 145 forks source link

System.PlatformNotSupportedException: Strings.PlatformNotSupported_DataSqlClient in .NET 5 #453

Closed Orcomp closed 3 years ago

Orcomp commented 3 years ago

Describe the bug

We've updated Insight.Database to version 6.3.4 to run on .NET 5.

Exception is thrown when we try and create a new sqlConnection.

Steps to reproduce

When we try and connect to the database we get the System.PlatformNotSupportedException exception.

[PlatformNotSupportedException] System.PlatformNotSupportedException: Strings.PlatformNotSupported_DataSqlClient at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString)

Expected behavior

Was running fine in version 6.2.8 on .NET 4.7.2

Orcomp commented 3 years ago

Could it be related to Insight.Database.Providers.MsSqlClient referencing an old version of Microsoft.Data.SqlClient

image

Orcomp commented 3 years ago

This may be somewhat related:

https://github.com/dotnet/SqlClient/issues/812 https://github.com/dotnet/SqlClient/issues/652#issuecomment-731615294

Unfortunately explicitly referencing Microsoft.Data.SqlClient 2.1.1 did not work for me.

Jaxelr commented 3 years ago

Could you post a minimal reproduction of the issue at hand?

I made a tiny console app using v6.3.4 targeting net 5.0 https://github.com/Jaxelr/InsightNet50MsConsoleSample and it works correctly for a simple query execution.

Orcomp commented 3 years ago

Sorry for the false alarm. It took a bit of investigating to realise the issue was on our end. We are embedding Insight.Database into a plugin using Costura, and didn't include the runtime. Now that we have, It is all working properly. Will close the issue.

greivinarr commented 3 years ago

I use Winforms, WPF and Console app in .net5 with ADO.net System.Data with no problems...; but when link to ASP.net core, throws System.PlatformNotSupportedException error... in both namespaces "System.Data" and "Microsoft.data"...

Orcomp commented 3 years ago

@greivinarr  make sure you are using the correct libraries and runtimes versions. You are probably referencing an (old) .NET framework library somewhere.