-
Notifications
You must be signed in to change notification settings - Fork 315
Description
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.
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