Skip to content

Commit fd60ce8

Browse files
authored
Fix a few more API compat inconsistencies (dotnet#68834)
1 parent 62859ff commit fd60ce8

File tree

8 files changed

+32
-0
lines changed

8 files changed

+32
-0
lines changed

src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.FreeBSD.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public TimeSpan TotalProcessorTime
5050
/// Returns the amount of time the associated thread has spent running code
5151
/// inside the application (not the operating system core).
5252
/// </summary>
53+
[UnsupportedOSPlatform("ios")]
54+
[UnsupportedOSPlatform("tvos")]
55+
[SupportedOSPlatform("maccatalyst")]
5356
public TimeSpan UserProcessorTime
5457
{
5558
get

src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ public bool UseProxy
617617
}
618618

619619
[UnsupportedOSPlatform("browser")]
620+
[UnsupportedOSPlatform("ios")]
621+
[UnsupportedOSPlatform("tvos")]
620622
public IWebProxy? Proxy
621623
{
622624
get

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,9 @@ internal void HandleAltSvc(IEnumerable<string> altSvcHeaderValues, TimeSpan? res
12051205

12061206
if (!nextAuthorityPersist)
12071207
{
1208+
#if !ILLUMOS && !SOLARIS
12081209
_poolManager.StartMonitoringNetworkChanges();
1210+
#endif
12091211
}
12101212
}
12111213
}

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPoolManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ internal sealed class HttpConnectionPoolManager : IDisposable
4444
private readonly IWebProxy? _proxy;
4545
private readonly ICredentials? _proxyCredentials;
4646

47+
#if !ILLUMOS && !SOLARIS
4748
private NetworkChangeCleanup? _networkChangeCleanup;
49+
#endif
4850

4951
/// <summary>
5052
/// Keeps track of whether or not the cleanup timer is running. It helps us avoid the expensive
@@ -150,6 +152,7 @@ public HttpConnectionPoolManager(HttpConnectionSettings settings)
150152
}
151153
}
152154

155+
#if !ILLUMOS && !SOLARIS
153156
/// <summary>
154157
/// Starts monitoring for network changes. Upon a change, <see cref="HttpConnectionPool.OnNetworkChanged"/> will be
155158
/// called for every <see cref="HttpConnectionPool"/> in the <see cref="HttpConnectionPoolManager"/>.
@@ -219,6 +222,7 @@ public void Dispose()
219222
GC.SuppressFinalize(this);
220223
}
221224
}
225+
#endif
222226

223227
public HttpConnectionSettings Settings => _settings;
224228
public ICredentials? ProxyCredentials => _proxyCredentials;
@@ -454,7 +458,9 @@ public void Dispose()
454458
pool.Value.Dispose();
455459
}
456460

461+
#if !ILLUMOS && !SOLARIS
457462
_networkChangeCleanup?.Dispose();
463+
#endif
458464
}
459465

460466
/// <summary>Sets <see cref="_cleaningTimer"/> and <see cref="_timerIsRunning"/> based on the specified timeout.</summary>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,11 @@ public partial class NetworkChange
335335
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
336336
[System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]
337337
public NetworkChange() { }
338+
[System.Runtime.Versioning.UnsupportedOSPlatform("illumos")]
339+
[System.Runtime.Versioning.UnsupportedOSPlatform("solaris")]
338340
public static event System.Net.NetworkInformation.NetworkAddressChangedEventHandler? NetworkAddressChanged { add { } remove { } }
341+
[System.Runtime.Versioning.UnsupportedOSPlatform("illumos")]
342+
[System.Runtime.Versioning.UnsupportedOSPlatform("solaris")]
339343
public static event System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler? NetworkAvailabilityChanged { add { } remove { } }
340344
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
341345
[System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]

src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.OSX.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Collections.Generic;
55
using System.Runtime.InteropServices;
6+
using System.Runtime.Versioning;
67
using Microsoft.Win32.SafeHandles;
78
using System.Diagnostics;
89
using System.Threading;
@@ -38,6 +39,8 @@ public partial class NetworkChange
3839
private static readonly AutoResetEvent s_runLoopStartedEvent = new AutoResetEvent(false);
3940
private static readonly AutoResetEvent s_runLoopEndedEvent = new AutoResetEvent(false);
4041

42+
[UnsupportedOSPlatform("illumos")]
43+
[UnsupportedOSPlatform("solaris")]
4144
public static event NetworkAddressChangedEventHandler? NetworkAddressChanged
4245
{
4346
add
@@ -75,6 +78,8 @@ public static event NetworkAddressChangedEventHandler? NetworkAddressChanged
7578
}
7679
}
7780

81+
[UnsupportedOSPlatform("illumos")]
82+
[UnsupportedOSPlatform("solaris")]
7883
public static event NetworkAvailabilityChangedEventHandler? NetworkAvailabilityChanged
7984
{
8085
add

src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Unix.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Diagnostics;
77
using System.Net.Sockets;
88
using System.Runtime.InteropServices;
9+
using System.Runtime.Versioning;
910
using System.Threading;
1011
using System.Threading.Tasks;
1112

@@ -43,6 +44,8 @@ private static Socket? Socket
4344
private static Timer? s_availabilityTimer;
4445
private static bool s_availabilityHasChanged;
4546

47+
[UnsupportedOSPlatform("illumos")]
48+
[UnsupportedOSPlatform("solaris")]
4649
public static event NetworkAddressChangedEventHandler? NetworkAddressChanged
4750
{
4851
add
@@ -83,6 +86,8 @@ public static event NetworkAddressChangedEventHandler? NetworkAddressChanged
8386
}
8487
}
8588

89+
[UnsupportedOSPlatform("illumos")]
90+
[UnsupportedOSPlatform("solaris")]
8691
public static event NetworkAvailabilityChangedEventHandler? NetworkAvailabilityChanged
8792
{
8893
add

src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Windows.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using System.Collections.Generic;
77
using System.Net.Sockets;
8+
using System.Runtime.Versioning;
89
using System.Threading;
910

1011
namespace System.Net.NetworkInformation
@@ -13,6 +14,8 @@ public partial class NetworkChange
1314
{
1415
private static readonly object s_globalLock = new object();
1516

17+
[UnsupportedOSPlatform("illumos")]
18+
[UnsupportedOSPlatform("solaris")]
1619
public static event NetworkAvailabilityChangedEventHandler? NetworkAvailabilityChanged
1720
{
1821
add
@@ -25,6 +28,8 @@ public static event NetworkAvailabilityChangedEventHandler? NetworkAvailabilityC
2528
}
2629
}
2730

31+
[UnsupportedOSPlatform("illumos")]
32+
[UnsupportedOSPlatform("solaris")]
2833
public static event NetworkAddressChangedEventHandler? NetworkAddressChanged
2934
{
3035
add

0 commit comments

Comments
 (0)