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

Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x64.dll' #1318

Closed
poyadav2001 opened this issue Oct 5, 2021 · 16 comments
Closed

Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x64.dll' #1318

poyadav2001 opened this issue Oct 5, 2021 · 16 comments
Labels
Area\Native SNI Issues that are targeted to the Native SNI codebase. ℹ️ Needs more Info Issues that have insufficient information to pursue investigations

Comments

@poyadav2001
Copy link

poyadav2001 commented Oct 5, 2021

Describe the bug

A clear and concise description of what the bug is.
{"Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}

To reproduce

Updated project that targets .NET Framework 4.7.2 to use Microsoft.Data.SqlClient from System.Data. SqlClient.
Cannot find the Microsoft.Data.SqlClient.SNI.x64.dll under bin folder. The dll is not automatically added by Microsoft.Data.SqlClient
<PackageReference Include="Microsoft.Data.SqlClient" Version="3.0.0" />

image

Further technical details

Microsoft.Data.SqlClient version: (found on the nuget or Microsoft.Data.SqlClient.dll) : 3.0.0
.NET target: (e.g. Framework 4.7.1, Core 2.2.2) .NET Framework 4.7.2
SQL Server version: (e.g. SQL Server 2017)
Operating system: (e.g. Windows 2019, Ubuntu 18.04, macOS 10.13, Docker container) Windows 2019

@JRahnama
Copy link
Contributor

JRahnama commented Oct 5, 2021

@poyadav2001 thanks for bringing this up. Are you accessing the driver inside a library and trying to use that library inside another project? In other words I want to know the architecture of your application and specifically where it uses M.D.S. A sample repro, something with minimal code that can help us to have a better understanding of the issue you are facing with, would be appreciated as well.

System.Data.SqlClient is shipped with the framework, hence it has all required dependencies available to itself. However Microsoft.Data.SqlClient is not benefiting from that privilege.

@JRahnama
Copy link
Contributor

JRahnama commented Oct 5, 2021

More to add: there are known issues similar to yours such as issue #745 or #1146.

@JRahnama JRahnama added the Area\Native SNI Issues that are targeted to the Native SNI codebase. label Oct 5, 2021
@poyadav2001
Copy link
Author

Link to our repo: https://microsoft.visualstudio.com/Universal%20Store/_git/SC.CST.Dunning
The project: https://microsoft.visualstudio.com/Universal%20Store/_git/SC.CST.Dunning?path=/Product/Billing/shared/Common/Common.csproj&version=GBu/poyadav/FileCopy&_a=contents
I have added a reference to M.D.S. in the project that is using it directly to access databases. It's not a deployment issue, I am getting this error on my local machine.

@JRahnama
Copy link
Contributor

JRahnama commented Oct 5, 2021

I believe I have access issue. I have tried reloading/refreshing the page but no luck.
image

@cheenamalhotra
Copy link
Member

Hi @poyadav2001

Can you try creating a standalone application using similar architecture and try to run some tests? The SNI DLLs are downloaded transitively to your bin folder when restoring/building the project and project properties can conflict with this transitive loading.

If you can reproduce this issue in a standalone app, we can investigate and assist further. That will also give you insights when you compare with a working application to figure out why in a particular project SNI DLLs are not downloading.

@cheenamalhotra cheenamalhotra added the ℹ️ Needs more Info Issues that have insufficient information to pursue investigations label Oct 5, 2021
@JRahnama
Copy link
Contributor

@poyadav2001 is this still an issue?

@Sajgoniarz
Copy link

Same issue here. Just created VSIX project, added Microsoft.SqlServer.SqlManagementObjects 161.47021.0 and after trying to create connection with DB i get this exception.

@ErikEJ
Copy link
Contributor

ErikEJ commented Jun 4, 2022

@Sajgoniarz hardly same issue, as a vsix is a dll file hosted and loaded in the Visual Studio process. Suggest you create a new issue with reproduction details or even better a sample project.

@kristianjaeger
Copy link

kristianjaeger commented Jun 7, 2022

I just repro-ed this today with Nuget Microsoft.Data.SqlClient 4.1.0 and the implicitly installed Microsoft.Data.SqlClient.SNI dependency of 4.0.0. This is using .NET Framework 4.7.2 on Windows 2016 Datacenter.
"Exception": "System.DllNotFoundException: Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E).
The files are included in a VisualStudio build (2019) but not Octopus package for some reason.

Update: a workaround seems to be to use System.Data.SqlClient namespace instead which is part of the .NET Framework.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

might be related to #727

I went to add/remove programs and ran repair on it, which fixed the problem

@RaghavaAkula394
Copy link

I just repro-ed this today with Nuget Microsoft.Data.SqlClient 4.1.0 and the implicitly installed Microsoft.Data.SqlClient.SNI dependency of 4.0.0. This is using .NET Framework 4.7.2 on Windows 2016 Datacenter. "Exception": "System.DllNotFoundException: Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E). The files are included in a VisualStudio build (2019) but not Octopus package for some reason.

Update: a workaround seems to be to use System.Data.SqlClient namespace instead which is part of the .NET Framework.

@RaghavaAkula394
Copy link

RaghavaAkula394 commented Apr 6, 2023

In my case ,I am updating from System.Data.SqlClient to Microsoft.Data.Sqlclient to configure Azure AD Managaed Identity and make my DB connection string password less

@Aashishkebab
Copy link

In my case ,I am updating from System.Data.SqlClient to Microsoft.Data.Sqlclient to configure Azure AD Managaed Identity and make my DB connection string password less

Did you ever figure this out?

@jons-bakerhill
Copy link

@Sajgoniarz Were you ever able to figure out the VSIX extension issue loading the SNI DLLs?

@SirMrDexter
Copy link

After I installed the latest OLE DB driver (19.3.2) it seems to be fixed. Not sure if this is reason.

@Aashishkebab

@cheenamalhotra
Copy link
Member

Closing as stale, no active known issue or repro available.

@cheenamalhotra cheenamalhotra closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area\Native SNI Issues that are targeted to the Native SNI codebase. ℹ️ Needs more Info Issues that have insufficient information to pursue investigations
Projects
None yet
Development

No branches or pull requests