Sqlclient: microsoft.data.sqlclient is not supported on this platform

Created on 5 Jul 2020  路  15Comments  路  Source: dotnet/SqlClient

Local Azure Functions no longer working after update to 2.0. As soon as SqlConnection is instantiated within a function, the exception pops up.

macOS Catalina v 10.15.5
Visual Studio for Mac Community v 8.6.5

Framework

  • Microsoft.NETCore.App(3.1.0) dotnet --version returns 3.1.301

Packages

  • Microsoft.Azure.WebJobs.Extension.Storage (4.02)
  • Microsoft.SqlData.SqlClient (2.0.0)
  • Microsoft.Sdk.Functions(3.0.8)

Once deployed to Azure, functions operate flawlessly.

External

Most helpful comment

Changed target platform to AnyCPU and added <RuntimeIdentifier>win10-x64</RuntimeIdentifier> to the PropertyGroup in my csproj... 3.0.8 + SqlClient now works for me in the azure function emulator.

All 15 comments

@chomelchizo Thanks for bringing this up to us. I have couple of questions/request to understand the situation better:

  1. Are you using Azure CLI on your local machine?
  2. From my understanding your application was working fine with Local Azure Functions using any versions prior to 2.0.0. Is that
    correct?
  3. I can see you are using the latest version of Microsoft.Sdk,Functions (3.0.8) which has been released 4 days ago. Can you
    kindly try your application with versions prior to that release as well?
  4. The very last question, Is it possible to provide us some sample application to work with?

Thanks.

@JRahnama,

  1. Are you using Azure CLI on your local machine?
    _Yes. (https://docs.microsoft.com/en-us/azure/azure-functions/functions-develop-vs#testing-functions) I test and debug the function app right from VS for Mac, which runs within a terminal.
    Azure Functions Core Tools 3.0.2358
    Function Runtime Version: 3.0.13159.0_
  1. From my understanding your application was working fine with Local Azure Functions using any versions prior to 2.0.0. Is that correct?
    _Yes. All functions work fine once deployed to Azure._
  1. I can see you are using the latest version of Microsoft.Sdk,Functions (3.0.8) which has been released 4 days ago. Can you kindly try your application with versions prior to that release as well?
    _I could, but not for a few days. Sorry._
  1. The very last question, Is it possible to provide us some sample application to work with?
    _Same response as 3._

@JRahnama

Downgraded Microsoft.NET.Sdk.Functions from 3.0.8 to 3.0.7 and local execution of functions worked.

Can also confirm this same error with local execution is addressed by Microsoft.NET.Sdk.Functions downgrade from 3.0.8 to 3.0.7.

Windows 10
Azure Functions Core Tools: 3.0.2630
Function Runtime: 3.0.13901.0
Target Framework: netcoreapp3.1

Changed target platform to AnyCPU and added <RuntimeIdentifier>win10-x64</RuntimeIdentifier> to the PropertyGroup in my csproj... 3.0.8 + SqlClient now works for me in the azure function emulator.

Closing this issue as it comes from external component.

I'm not using any other library. I'm just trying to create a simple connection in a Xamarin Workbook.

var conn = new Microsoft.Data.SqlClient.SqlConnection(connectionString)

The above code throws the same 'unsupported platform' error.

Framework: .NET Core 3.1
OS: macOS Catalina
Model Name: MacBook Pro
Processor Name: Quad-Core Intel Core i7
Processor Speed: 2.2 GHz
Number of Processors: 1
Total Number of Cores: 4
Memory: 16 GB

image

s 2020-07-24 at 18 45 18

Have you tested with Microsoft.Data.SqlClient v2.0.0 as well ?

Yes that's the version I was using. Strange, the same code works with Rider though!

s 2020-07-24 at 18 53 39

I also tested older versions till 1.0.19239.1 and all work for me.
Works in Visual Studio for Mac, Visual Studio Code (dotnet cli).

Maybe an issue with Xamarin workbooks?

Environment.OSVersion.Platform returns Unix even though it's macOS. But that's the same if I'm using Rider or Xamarin Workbooks. It seems to be an issue with Xamarin Workbooks by the looks of it. I haven't had any issues until now.

I also tested older versions till 1.0.19239.1 and all work for me.
Works in Visual Studio for Mac, Visual Studio Code (dotnet cli).

Maybe an issue with Xamarin workbooks?

Yeah, it seems like it. Thanks for getting back so promptly, help appreciated :-)

Okay, I thought I'd add this as it might be relevant if someone else ends up here. If you set the Console type to System Mono instead of .NET Core in Xamarin Workbooks everything works as expected. I have no idea why this is, though I noticed when I run the workbooks terminal binary it hits some path problems. These seem to be due to the fact I don't have the full Xamarin installed (I installed Workbooks only). Anyway, I hope this helps someone :-)

s 2020-07-24 at 20 05 21

Was this page helpful?
0 / 5 - 0 ratings