Skip to content

assembly load issue with simple script using System.Data.SqlClient #166

@softeering

Description

@softeering

Hi,

I'm facing an issue while trying to execute the following script which loads the System.Data.SqlClient nuget package:

#! "netcoreapp2.0"
#r "nuget:NetStandard.Library,2.0.0"
#r "nuget:System.Data.SqlClient, 4.4.0"

using System.Data.SqlClient;

using (var connection = new SqlConnection(""))
{
	connection.Open();
	Console.WriteLine("Hello world!");
}

This seems to be loading the default implementation of System.Data.SqlClient instead of the one specific to the platform.
The error message is:

PS C:\Temp\tdstest> dotnet script .\helloworld.csx
Script execution resulted in an exception.
System.Data.SqlClient is not supported on this platform.
   at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
   at Submission#0.<<Initialize>>d__0.MoveNext() in C:\Temp\tdstest\helloworld.csx:line 7
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.<RunSubmissionsAsync>d__9`1.MoveNext()
System.Data.SqlClient is not supported on this platform.

Any idea if and how I could workaround this?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions