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

M2 Parallels Failed to load dll 'Microsoft.Data.SqlClient.SNI.arm64.dll' #2389

Open
AzmogEx opened this issue Mar 5, 2024 · 10 comments
Open

Comments

@AzmogEx
Copy link

AzmogEx commented Mar 5, 2024

Hello
I am on Mac M2 with parallels and I use sql server and visual studio 2022 but I have a dll problem when I try to connect to a sql server

Failed to load DLL 'Microsoft.Data.SqlClient.SNI.arm64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) (Microsoft.Data.SqlClient)

====================================

Failed to load DLL 'Microsoft.Data.SqlClient.SNI.arm64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) (Microsoft.Data.SqlClient)


Program Location:

at Microsoft.Data.SqlClient.SNINativeManagedWrapperARM64.UnmanagedIsTokenRestricted(IntPtr token, Boolean& isRestricted)
at Microsoft.Data.SqlClient.SNINativeMethodWrapper.UnmanagedIsTokenRestricted(IntPtr token, Boolean& isRestricted)
at Microsoft.Data.Win32NativeMethods.IsTokenRestrictedWrapper(IntPtr token)
at Microsoft.Data.ProviderBase.DbConnectionPoolIdentity.GetCurrent()
at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
at Microsoft.SqlServer.ConnectionDlg.Core.Impl.SqlServerDatabaseDiscoveryProvider.GetDatabaseInstancesFromSqlConnection(UIConnectionInfo uiConnectionInfo, CancellationToken cancellationToken)
at Microsoft.SqlServer.ConnectionDlg.Core.Impl.SqlServerDatabaseDiscoveryProvider.GetDatabaseInstances(UIConnectionInfo uiConnectionInfo, CancellationToken cancellationToken)

Thanks you

@JRahnama JRahnama added this to Needs triage in SqlClient Triage Board via automation Mar 6, 2024
@JRahnama
Copy link
Member

JRahnama commented Mar 6, 2024

@AzmogEx is this happening on just a simple Open command?

@hhhhrh
Copy link

hhhhrh commented Mar 9, 2024

same issue
please tell me if you find a fix

@AzmogEx
Copy link
Author

AzmogEx commented Mar 9, 2024

@AzmogEx is this happening on just a simple Open command?

@JRahnama this happens when i try to connect to a sql server in visual studio

@AzmogEx
Copy link
Author

AzmogEx commented Mar 9, 2024

same issue please tell me if you find a fix

@hhhhrh Currently I'm using text messages to do this while I wait for the issue to be resolved.

@JRahnama
Copy link
Member

JRahnama commented Mar 9, 2024

@AzmogEx can you provide a simple repro including connection string properties and csproj please?

@JRahnama
Copy link
Member

@AzmogEx can you check the bin folder to see if the file is copied to that folder?

@JRahnama JRahnama moved this from Needs triage to Needs Investigation in SqlClient Triage Board Mar 12, 2024
@JRahnama
Copy link
Member

JRahnama commented Mar 12, 2024

Also you can use AppContext.SetSwitch to eliminate use of native dll and use managed SNI on your device to see if that solves the issue for you.

@frankbuckley
Copy link

I can replicate using Windows 11 Pro on ARM (on Parallels on a MacBook M3):

On Windows 11 running in Parallels on Mac...

  • Open Visual Studio 2022 (17.9.3)
  • View SQL Server Object Explorer
  • Connect - fill in database IP address and port, use SQL authentication
  • Click Connect - nothing happens
  • Click dropdown for databases

image

However this works...

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
  </ItemGroup>

</Project>
using Microsoft.Data.SqlClient;

var connectionString = "Server=tcp:fbmacbook.local;" + // fails to connect if IP address is used
    "Initial Catalog=master;User ID=sa;Password=password;" +
    "Encrypt=False;";

using (var connection = new SqlConnection(connectionString))
{
    connection.Open();
    Console.WriteLine("Connected to SQL Server");
}

SQL Server is running in a Docker container with emulation.

@AzmogEx
Copy link
Author

AzmogEx commented Mar 14, 2024 via email

@frankbuckley
Copy link

I can confirm that this is fixed in the latest Visual Studio Preview (17.10.0 Preview 2.0) - which also includes SSDT support for ARM.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
SqlClient Triage Board
  
Needs Investigation
Development

No branches or pull requests

4 participants