Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
Expand Down Expand Up @@ -396,12 +395,12 @@ internal SqlConnectionString(string connectionString) : base(connectionString, G
if (_networkLibrary != null)
{ // MDAC 83525
string networkLibrary = _networkLibrary.Trim().ToLower(CultureInfo.InvariantCulture);
Hashtable netlib = NetlibMapping();
Dictionary<string, string> netlib = NetlibMapping();
if (!netlib.ContainsKey(networkLibrary))
{
throw ADP.InvalidConnectionOptionValue(KEY.Network_Library);
}
_networkLibrary = (string)netlib[networkLibrary];
_networkLibrary = netlib[networkLibrary];
}
else
{
Expand Down Expand Up @@ -1101,14 +1100,14 @@ internal SqlConnectionEncryptOption ConvertValueToSqlConnectionEncrypt()
}
}

static internal Hashtable NetlibMapping()
static internal Dictionary<string, string> NetlibMapping()
{
const int NetLibCount = 8;

Hashtable hash = s_netlibMapping;
Dictionary<string, string> hash = s_netlibMapping;
if (hash == null)
{
hash = new Hashtable(NetLibCount)
hash = new Dictionary<string, string>(NetLibCount)
{
{ NETLIB.TCPIP, TdsEnums.TCP },
{ NETLIB.NamedPipes, TdsEnums.NP },
Expand Down Expand Up @@ -1150,7 +1149,7 @@ internal static class NETLIB
internal const string VIA = "dbmsgnet";
}

private static Hashtable s_netlibMapping;
private static Dictionary<string, string> s_netlibMapping;

#if NETFRAMEWORK
protected internal override PermissionSet CreatePermissionSet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,14 @@ internal static int GetCurrentProcessIdForTdsLoginOnly()
// Pick up the process Id from the current process instead of randomly generating it.
// This would be helpful while tracing application related issues.
int processId;
#if NET
processId = Environment.ProcessId;
#else
using (System.Diagnostics.Process p = System.Diagnostics.Process.GetCurrentProcess())
{
processId = p.Id;
}
#endif
System.Threading.Volatile.Write(ref s_currentProcessId, processId);
}
return s_currentProcessId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Runtime.Serialization.Json;
using System.Security.Cryptography.X509Certificates;
using System.Text.Json;
using System.Threading;

namespace Microsoft.Data.SqlClient
Expand Down Expand Up @@ -72,8 +72,7 @@ protected override byte[] MakeRequest(string url)

using (Stream stream = s_client.GetStreamAsync(url).ConfigureAwait(false).GetAwaiter().GetResult())
{
var deserializer = new DataContractJsonSerializer(typeof(byte[]));
return (byte[])deserializer.ReadObject(stream);
return JsonSerializer.Deserialize<List<byte>>(stream)?.ToArray();
}
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private X509Certificate2Collection GetSigningCertificate(string attestationUrl,

try
{
var s = new SignedCms();
SignedCms s = new SignedCms();
s.Decode(data);
certificateCollection.AddRange(s.Certificates);
}
Expand Down
Loading