Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. #2082

Copy link
Copy link

Description

@chandrashekharjoshi-abb
Issue body actions

Describe the bug

When i add nuget package Microsoft.SqlServer.SqlManagementObjects 170.18.0 for SMO APIs(it also adds lot of dependecy packages), One of the dependency is Microsoft.Data.SqlClient, which is using old version of System.Memory 4.0.1.1 while package downloads 4.0.1.2.
image

we always get exception on SqlConnection.Open() function call. below is the fusion log:

Pre-bind state information
LOG: DisplayName = System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
(Fully-specified)
LOG: Appbase = file:///C:/ABB.SDS.SDK/host/Server/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5.

LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\ABB.SDS.SDK\host\Server\MOMServices.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
LOG: Attempting download of new URL file:///C:/ABB.SDS.SDK/host/Server/System.Memory.DLL.
LOG: Attempting download of new URL file:///C:/ABB.SDS.SDK/host/Server/System.Memory/System.Memory.DLL.
LOG: Attempting download of new URL file:///C:/ABB.SDS.SDK/host/Server/Apps/Configurator/desktop/System.Memory.DLL.
LOG: Attempting download of new URL file:///C:/ABB.SDS.SDK/host/Server/Apps/Configurator/desktop/System.Memory/System.Memory.DLL.
LOG: Attempting download of new URL file:///C:/ABB.SDS.SDK/host/Server/System.Memory.EXE.
LOG: Attempting download of new URL file:///C:/ABB.SDS.SDK/host/Server/System.Memory/System.Memory.EXE.
LOG: Attempting download of new URL file:///C:/ABB.SDS.SDK/host/Server/Apps/Configurator/desktop/System.Memory.EXE.
LOG: Attempting download of new URL file:///C:/ABB.SDS.SDK/host/Server/Apps/Configurator/desktop/System.Memory/System.Memory.EXE.
LOG: Attempting download of new URL file:///C:/ABB.SDS.SDK/host/Server/Apps/ABB.SDS.Batch.Accessors.Server/server/System.Memory.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number

To reproduce

Use Microsoft.SqlServer.SqlManagementObjects 170.18.0 and exectute SqlConnection

Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.

using (SqlConnection con = new SqlConnection())
            {
               con.ConnectionString = Utility.GetConnectionString(connectionParameter);
               if (connectionParameter.UseAuthenticationMode == AuthenticationMode.Sql)
               {
                  SqlCredential cred = new SqlCredential(connectionParameter.UserName, connectionParameter.Password);
                  con.Credential = cred;
               }

               Server server = new Server(new ServerConnection(con));
               // Open connection.
               con.Open();
               if (con.State != System.Data.ConnectionState.Open)
                  return false;

               if (server.VersionMajor < connectionParameter.ServerVersionNumber)
               {
                  throw new NotSupportedException("This SQL server version is not supported. The minimum version number is " + connectionParameter.ServerVersionNumber.ToString(CultureInfo.CurrentCulture));
               }

               return true;
            }

Expected behavior

A clear and concise description of what you expected to happen.

Further technical details

Microsoft.Data.SqlClient version: Nuget version 5.1.1
.NET target: 4.8
SQL Server version: 2019
Operating system: Windows Server 2016

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Repro Available ✔️Issues that are reproducible with repro provided.Issues that are reproducible with repro provided.

    Type

    Projects

    Status
    Backlog
    Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.