-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Azure Functions - System.Data.SqlClient is not supported on this platform #27966
Comments
I don't think Azure Functions supports preview versions of .NET Core. |
I'm using the latest (non-preview) version, but still the azure function is throwing the exception. --> Has a dependency on 4.6.0I assume it's no longer preview ? |
Same problem here, SqlDataClient 4.6.0 is no longer preview ("latest stable"), is it possible to reopen this issue or do I need to open a new one? |
Same issue here with SqlDataClient 4.6.0 |
We need more information - first I would recommend to find out what is the Azure Functions platform. Which .NET Framework or .NET Core version. |
Can you provide the entire stack trace? |
There is no extra stacktrace available except this : System.Private.CoreLib: Exception while executing function: Function1. System.Data.SqlClient: System.Data.SqlClient is not supported on this platform.
|
Mine is bare ADO.NET: VS 15.9.3, Core SDK 2.2.101 var config = new ConfigurationBuilder() I get a runtime error when it tries to open the connection, the final entries in Output window are: 'func.exe' (CoreCLR: clrhost): Loaded 'C:\Users\M.Dean\AppData\Local\AzureFunctionsTools\Releases\2.14.0\cli\System.Data.SqlClient.dll'. Symbols loaded. It works fine with SqlDataClient 4.5.1 Edit to add - from above it appears the exception is thrown from SqlDataClient so it's maybe one for the ADO.Net team? |
I tried to create an Azure Function to test this and I found I've only got one template in VS 2017 for azure functions and it sets up a project that uses Netfx not Corefx. So I went looking and found this: https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions and the transition from 1.x to 2.x guidelines which state that you should change the project to contain:
If you make that change when restoring nuget packages the build system will give you netstandard binary versions of dependencies. Netstandard isn't a real runtime so the binaries for it are reference only, they contain the public surface area but as you've seen they don't have an implementation. To get the implementation you have to restore using a TFM for a real runtime, in this case you'd want to use netcoreapp2.2 I think. |
I have the same issue as bartdk-be. I upgraded my Azure Function from .NET Standard 2.0 to .NET Core 2.2 today and out of the blue this error now happens. It is running a package that is running Entity Framework Core 2.2. I have tried manually installing via Nuget System.Data.SqlClient for 4.6 and then going back versions. It just won't work at all at this point. I am thinking about going back till it gets sorted out. The interesting thing in my case is I have a .NET Standard library project I used it for prior due to Azure Functions previously being on .NET Standard. I upgraded it as well to be .NET Core 2.2 but no dice. |
I too am receiving this error. My Functions application is not on .NET Core 2.2, however. I saw the other issue that .NET Core 2.2 is not yet supported on Functions host. I'm using .NET Core 2.1, which is what the VS template created. I'm trying to use
Not much to it. Edit: This StackOverflow post seems to acknowledge the issue, mentions it's being tracked and recommends a workaround that resolved the exception for me. |
Hello, anymore progress on this? I am getting the issue as well.
|
@danimal521 I was able to resolve the issue by downgrading the |
@ryancole that totally worked! I used 4.5.1 seemed to be the last prod build. |
4.5.1 might "solve" (workaround) the issue as stated in the title.
So using AAD auth towards Azure SQL is not possible in combination with Azure Functions... |
Same issue when using the 4.70-preview-18571.3 (preview) release. |
Did you try the target framework moniker thing I suggested earlier? I've been working on sqlclient and having no trouble with restores but i'm using netcoreapp as my target. if you use netstandard I think you'll get the stub verison with PNSE's in it. |
Mine is already set to the netcoreapp...
Or am I missing the ball on what you're trying to point me to? |
Makes no difference. The V2 function templates give you those settings by default anyway. |
@ryancole @danimal521 I downloaded 4.6.1 (prod release), the error is gone. Thanks for sharing the solution. |
Got the problem with 4.7.0 today. And the Microsoft.Data.SqlClient gives me the same error |
I experienced the same thing with 4.7.0 + higher versions.
As you can see, I've tried updating to the latest "preview" packages for "Microsoft.NET.Sdk.Functions" and "System.Data.SqlClient." |
I can confirm. Downgrading to 4.6.1 resolved this issue for me as well. |
This needs to be reopened, nothing is in preview anymore outside of core 3 functions support and this is occurring across the board for anything about 4.6.1. |
It should be moved to https://github.com/Azure/azure-functions-host/ |
@davidfowl Are you volunteering? |
No, I'm explaining where the issue should be filed because it's not a corefx problem. |
Updating the people in this thread to note that this issue is also opened in the repo @davidfowl linked above: Azure/azure-functions-host#3903 , with a couple workarounds. If you're still having issues, I'd suggest looking / commenting there! |
having the same issue with PackageReference Include="System.Data.SqlClient" Version="4.7.0" but worked with 4.6.1 |
Same issue here: "System.Data.SqlClient" Version="4.7.0". Quite disappointing. We have been evaluating .Net Core, Azure functions for a large enterprise project. Strange issues with other .Net Core-based libraries as well. Things just look too flaky for a long term commitment. |
Has this been fixed? I am trying to use System.Data.SqlClient in Azure function v3. Downgrading to 4.6.1 does not work for me. |
This local.settings.json:
and additional targets:
"fixed" this for me. |
Just adding "FUNCTIONS_V2_COMPATIBILITY_MODE": "true" helped |
Worked for me as well... Thank you! |
Awesome. Worked for me too! Thanks! |
Adding "FUNCTIONS_V2_COMPATIBILITY_MODE": "true" worked! Thank you @vitalybibikov |
Thak you @vitalybibikov |
@cheenamalhotra is there any action required here? Can you please help evaluate. |
We've verified that Microsoft.Data.SqlClient is supported with Azure Functions all versions (v1, v2 and v3). A demo app that can be tested with deployment is available here: Same should also work with System.Data.SqlClient and is also verified above. If there's any open support remaining on the same, please feel free to redirect to dotnet/sqlclient! |
@cheenamalhotra - I took this sample project upgraded to the Azure functions SDK to the latest (3.0.3), updated the version of Azure functions in the project file to use v3 and then replaced Microsoft.Data.SqlClient with System.Data.SqlClient and then added this to the test function: SqlConnectionStringBuilder connStrBldr = new SqlConnectionStringBuilder and I got this error, which suggests that System.Data.SqlClient and not working properly. In my tests if I use Microsoft.Data.SqlClient it does work _
_ We can´t migrate our code over to use Microsoft.Data.SqlClient because we are relying on https://www.nuget.org/packages/Microsoft.Azure.SqlDatabase.ElasticScale.Client/ which relies on System.Data.SqlClient Fyi.., setting "FUNCTIONS_V2_COMPATIBILITY_MODE": "true" does solve this |
Closing this issue as we don't reproduce any problems with SqlClient, but the problems emerge due to Azure Functions SDK existing issues. For anyone facing this issue, please create a new issue with reproducible app provided in dotnet/sqlclient repository if any problems are found with SqlClient libraries. |
Adding "FUNCTIONS_V2_COMPATIBILITY_MODE": "true" worked! |
Hi Team,
When using System.Data.SqlClient ( 4.6.0-preview-versions ) with azure functions, following exceptions is being thrown.
4.6.0-preview3-27014-02
System.Private.CoreLib: One or more errors occurred. (System.Data.SqlClient is not supported on this platform.). System.Data.SqlClient: System.Data.SqlClient is not supported on this platform
Downgrading the version to 4.5.1 works fine.
Tried with
2.2.100-preview2-009404
SDK too, still getting the same exception.I am using the preview version because we need to use the AAD accesstoken property on
SqlConnection
Object.The text was updated successfully, but these errors were encountered: