Skip to content

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

Closed as not planned

Description

@poyadav2001

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

Activity

  1. JRahnama commented on Oct 5, 2021

    @JRahnama
    Contributor

    @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.

  2. JRahnama commented on Oct 5, 2021

    @JRahnama
    Contributor

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

  3. added
    Area\Native SNI
    on Oct 5, 2021
  4. JRahnama commented on Oct 5, 2021

    @JRahnama
    Contributor

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

  5. cheenamalhotra commented on Oct 5, 2021

    @cheenamalhotra
    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.

  6. JRahnama commented on Jan 12, 2022

    @JRahnama
    Contributor

    @poyadav2001 is this still an issue?

  7. mnaharnowicz-fp commented on Jun 4, 2022

    @mnaharnowicz-fp

    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.

  8. ErikEJ commented on Jun 4, 2022

    @ErikEJ
    Contributor

    @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.

  9. kristianjaeger commented on Jun 7, 2022

    @kristianjaeger

    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.

  10. SynapseScribe commented on Jan 26, 2023

    @SynapseScribe

    might be related to #727

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

  11. RaghavaAkula394 commented on Apr 6, 2023

    @RaghavaAkula394

    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.

  12. RaghavaAkula394 commented on Apr 6, 2023

    @RaghavaAkula394

    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

  13. Aashishkebab commented on Apr 26, 2023

    @Aashishkebab

    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?

  14. jons-bakerhill commented on May 12, 2023

    @jons-bakerhill

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

  15. SirMrDexter commented on Nov 24, 2023

    @SirMrDexter

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

    @Aashishkebab

  16. cheenamalhotra commented on Nov 15, 2024

    @cheenamalhotra
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area\Native SNI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions