Skip to content

Commit

Permalink
Add platform guard to IsSupported (#103342)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManickaP authored Jun 18, 2024
1 parent 84874d8 commit 3620294
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libraries/System.Net.Quic/ref/System.Net.Quic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public QuicClientConnectionOptions() { }
public sealed partial class QuicConnection : System.IAsyncDisposable
{
internal QuicConnection() { }
[Runtime.Versioning.SupportedOSPlatformGuard("windows")]
[Runtime.Versioning.SupportedOSPlatformGuard("linux")]
[Runtime.Versioning.SupportedOSPlatformGuard("osx")]
public static bool IsSupported { get { throw null; } }
public System.Net.IPEndPoint LocalEndPoint { get { throw null; } }
public System.Net.Security.SslApplicationProtocol NegotiatedApplicationProtocol { get { throw null; } }
Expand Down Expand Up @@ -73,6 +76,9 @@ public QuicException(System.Net.Quic.QuicError error, long? applicationErrorCode
public sealed partial class QuicListener : System.IAsyncDisposable
{
internal QuicListener() { }
[Runtime.Versioning.SupportedOSPlatformGuard("windows")]
[Runtime.Versioning.SupportedOSPlatformGuard("linux")]
[Runtime.Versioning.SupportedOSPlatformGuard("osx")]
public static bool IsSupported { get { throw null; } }
public System.Net.IPEndPoint LocalEndPoint { get { throw null; } }
public System.Threading.Tasks.ValueTask<System.Net.Quic.QuicConnection> AcceptConnectionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.Versioning;

namespace System.Net.Quic;

public sealed partial class QuicConnection
{
[SupportedOSPlatformGuard("windows")]
[SupportedOSPlatformGuard("linux")]
[SupportedOSPlatformGuard("osx")]
public static bool IsSupported => false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Channels;
Expand Down Expand Up @@ -44,6 +45,9 @@ public sealed partial class QuicConnection : IAsyncDisposable
/// The current implementation depends on <see href="https://github.com/microsoft/msquic">MsQuic</see> native library, this property checks its presence (Linux machines).
/// It also checks whether TLS 1.3, requirement for QUIC protocol, is available and enabled (Windows machines).
/// </remarks>
[SupportedOSPlatformGuard("windows")]
[SupportedOSPlatformGuard("linux")]
[SupportedOSPlatformGuard("osx")]
public static bool IsSupported => MsQuicApi.IsQuicSupported;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.Versioning;

namespace System.Net.Quic;

public sealed partial class QuicListener
{
[SupportedOSPlatformGuard("windows")]
[SupportedOSPlatformGuard("linux")]
[SupportedOSPlatformGuard("osx")]
public static bool IsSupported => false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Authentication;
using System.Threading;
using System.Threading.Channels;
Expand Down Expand Up @@ -36,6 +37,9 @@ public sealed partial class QuicListener : IAsyncDisposable
/// The current implementation depends on <see href="https://github.com/microsoft/msquic">MsQuic</see> native library, this property checks its presence (Linux machines).
/// It also checks whether TLS 1.3, requirement for QUIC protocol, is available and enabled (Windows machines).
/// </remarks>
[SupportedOSPlatformGuard("windows")]
[SupportedOSPlatformGuard("linux")]
[SupportedOSPlatformGuard("osx")]
public static bool IsSupported => MsQuicApi.IsQuicSupported;

/// <summary>
Expand Down

0 comments on commit 3620294

Please sign in to comment.