Skip to content

Commit

Permalink
Suppress roslyn errors and warnings (#2936)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheenamalhotra authored Oct 29, 2024
1 parent a947223 commit 699f6ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,12 @@ internal override uint WaitForSSLHandShakeToComplete(out int protocolVersion)
uint returnValue = SNINativeMethodWrapper.SNIWaitForSSLHandshakeToComplete(Handle, GetTimeoutRemaining(), out uint nativeProtocolVersion);
var nativeProtocol = (NativeProtocols)nativeProtocolVersion;
#pragma warning disable CA5398 // Avoid hardcoded SslProtocols values
if (nativeProtocol.HasFlag(NativeProtocols.SP_PROT_TLS1_2_CLIENT) || nativeProtocol.HasFlag(NativeProtocols.SP_PROT_TLS1_2_SERVER))
{
protocolVersion = (int)SslProtocols.Tls12;
}
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
else if (nativeProtocol.HasFlag(NativeProtocols.SP_PROT_TLS1_3_CLIENT) || nativeProtocol.HasFlag(NativeProtocols.SP_PROT_TLS1_3_SERVER))
{
/* The SslProtocols.Tls13 is supported by netcoreapp3.1 and later */
Expand Down Expand Up @@ -439,6 +440,7 @@ internal override uint WaitForSSLHandShakeToComplete(out int protocolVersion)
{
protocolVersion = (int)SslProtocols.None;
}
#pragma warning restore CA5398 // Avoid hardcoded SslProtocols values
return returnValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ private static string ToFriendlyName(this SslProtocols protocol)
{
name = "TLS 1.3";
}*/
#pragma warning disable CA5398 // Avoid hardcoded SslProtocols values
if ((protocol & SslProtocols.Tls12) == SslProtocols.Tls12)
{
name = "TLS 1.2";
Expand Down Expand Up @@ -795,6 +796,7 @@ private static string ToFriendlyName(this SslProtocols protocol)
{
name = "SSL 2.0";
}
#pragma warning restore CA5398 // Avoid hardcoded SslProtocols values
else
{
#if !NETFRAMEWORK
Expand All @@ -818,9 +820,11 @@ public static string GetProtocolWarning(this SslProtocols protocol)
#if NET8_0_OR_GREATER
#pragma warning disable SYSLIB0039 // Type or member is obsolete: TLS 1.0 & 1.1 are deprecated
#endif
#pragma warning disable CS0618 // Type or member is obsolete : SSL is depricated
#pragma warning disable CS0618 // Type or member is obsolete : SSL is deprecated
#pragma warning disable CA5398 // Do not use deprecated SslProtocols values
if ((protocol & (SslProtocols.Ssl2 | SslProtocols.Ssl3 | SslProtocols.Tls | SslProtocols.Tls11)) != SslProtocols.None)
#pragma warning restore CS0618 // Type or member is obsolete : SSL is depricated
#pragma warning restore CA5398 // Do not use deprecated SslProtocols values
#pragma warning restore CS0618 // Type or member is obsolete : SSL is deprecated
#if NET8_0_OR_GREATER
#pragma warning restore SYSLIB0039 // Type or member is obsolete: SSL and TLS 1.0 & 1.1 is deprecated
#endif
Expand Down

0 comments on commit 699f6ab

Please sign in to comment.