Skip to content

Commit 1ffd525

Browse files
committed
Add platform guard to IsSupported
1 parent 3073a03 commit 1ffd525

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

src/libraries/System.Net.Quic/ref/System.Net.Quic.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public QuicClientConnectionOptions() { }
2323
public sealed partial class QuicConnection : System.IAsyncDisposable
2424
{
2525
internal QuicConnection() { }
26+
[Runtime.Versioning.SupportedOSPlatformGuard("windows")]
27+
[Runtime.Versioning.SupportedOSPlatformGuard("linux")]
28+
[Runtime.Versioning.SupportedOSPlatformGuard("osx")]
2629
public static bool IsSupported { get { throw null; } }
2730
public System.Net.IPEndPoint LocalEndPoint { get { throw null; } }
2831
public System.Net.Security.SslApplicationProtocol NegotiatedApplicationProtocol { get { throw null; } }
@@ -73,6 +76,9 @@ public QuicException(System.Net.Quic.QuicError error, long? applicationErrorCode
7376
public sealed partial class QuicListener : System.IAsyncDisposable
7477
{
7578
internal QuicListener() { }
79+
[Runtime.Versioning.SupportedOSPlatformGuard("windows")]
80+
[Runtime.Versioning.SupportedOSPlatformGuard("linux")]
81+
[Runtime.Versioning.SupportedOSPlatformGuard("osx")]
7682
public static bool IsSupported { get { throw null; } }
7783
public System.Net.IPEndPoint LocalEndPoint { get { throw null; } }
7884
public System.Threading.Tasks.ValueTask<System.Net.Quic.QuicConnection> AcceptConnectionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Runtime.Versioning;
5+
46
namespace System.Net.Quic;
57

68
public sealed partial class QuicConnection
79
{
10+
[SupportedOSPlatformGuard("windows")]
11+
[SupportedOSPlatformGuard("linux")]
12+
[SupportedOSPlatformGuard("osx")]
813
public static bool IsSupported => false;
914
}

src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Runtime.CompilerServices;
88
using System.Runtime.ExceptionServices;
99
using System.Runtime.InteropServices;
10+
using System.Runtime.Versioning;
1011
using System.Security.Cryptography.X509Certificates;
1112
using System.Threading;
1213
using System.Threading.Channels;
@@ -44,6 +45,9 @@ public sealed partial class QuicConnection : IAsyncDisposable
4445
/// The current implementation depends on <see href="https://github.com/microsoft/msquic">MsQuic</see> native library, this property checks its presence (Linux machines).
4546
/// It also checks whether TLS 1.3, requirement for QUIC protocol, is available and enabled (Windows machines).
4647
/// </remarks>
48+
[SupportedOSPlatformGuard("windows")]
49+
[SupportedOSPlatformGuard("linux")]
50+
[SupportedOSPlatformGuard("osx")]
4751
public static bool IsSupported => MsQuicApi.IsQuicSupported;
4852

4953
/// <summary>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Runtime.Versioning;
5+
46
namespace System.Net.Quic;
57

68
public sealed partial class QuicListener
79
{
10+
[SupportedOSPlatformGuard("windows")]
11+
[SupportedOSPlatformGuard("linux")]
12+
[SupportedOSPlatformGuard("osx")]
813
public static bool IsSupported => false;
914
}

src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Runtime.CompilerServices;
77
using System.Runtime.ExceptionServices;
88
using System.Runtime.InteropServices;
9+
using System.Runtime.Versioning;
910
using System.Security.Authentication;
1011
using System.Threading;
1112
using System.Threading.Channels;
@@ -36,6 +37,9 @@ public sealed partial class QuicListener : IAsyncDisposable
3637
/// The current implementation depends on <see href="https://github.com/microsoft/msquic">MsQuic</see> native library, this property checks its presence (Linux machines).
3738
/// It also checks whether TLS 1.3, requirement for QUIC protocol, is available and enabled (Windows machines).
3839
/// </remarks>
40+
[SupportedOSPlatformGuard("windows")]
41+
[SupportedOSPlatformGuard("linux")]
42+
[SupportedOSPlatformGuard("osx")]
3943
public static bool IsSupported => MsQuicApi.IsQuicSupported;
4044

4145
/// <summary>

0 commit comments

Comments
 (0)