From 7ca4d6fdc280e9638e6a136f4245decbf0500c65 Mon Sep 17 00:00:00 2001 From: Radek Zikmund <32671551+rzikm@users.noreply.github.com> Date: Fri, 29 Jul 2022 12:56:02 +0200 Subject: [PATCH] Fix UnsupportedOSPlatformAttribute usage in System.Net.NetworkInformation.cs (#72792) * Test attribute on IsDnsEligible * Add more attributes * Icmp statistics * IPGlobalProperties * IPInterfaceProperties * IPInterfaceStatistics * Replace unsupportedOS attribute by SupportedOS attribute * IPv4/6InterfaceProperties --- .../ref/System.Net.NetworkInformation.cs | 214 ++++++++++++++------- .../Net/NetworkInformation/IPAddressInformation.cs | 4 + .../Net/NetworkInformation/IPGlobalProperties.cs | 4 + .../NetworkInformation/IPInterfaceProperties.cs | 16 +- .../NetworkInformation/IPInterfaceStatistics.cs | 2 + .../NetworkInformation/IPv4InterfaceProperties.cs | 12 +- .../NetworkInformation/IPv6InterfaceProperties.cs | 6 + .../Net/NetworkInformation/IcmpV4Statistics.cs | 18 ++ .../Net/NetworkInformation/IcmpV6Statistics.cs | 18 ++ .../MulticastIPAddressInformation.cs | 8 + .../UnicastIPAddressInformation.cs | 7 + 11 files changed, 230 insertions(+), 79 deletions(-) diff --git a/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs b/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs index df04b53..da345ad 100644 --- a/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs +++ b/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs @@ -46,9 +46,25 @@ namespace System.Net.NetworkInformation public abstract long EchoRepliesSent { get; } public abstract long EchoRequestsReceived { get; } public abstract long EchoRequestsSent { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long ErrorsReceived { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long ErrorsSent { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long MessagesReceived { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long MessagesSent { get; } public abstract long ParameterProblemsReceived { get; } public abstract long ParameterProblemsSent { get; } @@ -72,7 +88,15 @@ namespace System.Net.NetworkInformation public abstract long EchoRepliesSent { get; } public abstract long EchoRequestsReceived { get; } public abstract long EchoRequestsSent { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long ErrorsReceived { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long ErrorsSent { get; } public abstract long MembershipQueriesReceived { get; } public abstract long MembershipQueriesSent { get; } @@ -80,7 +104,15 @@ namespace System.Net.NetworkInformation public abstract long MembershipReductionsSent { get; } public abstract long MembershipReportsReceived { get; } public abstract long MembershipReportsSent { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long MessagesReceived { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long MessagesSent { get; } public abstract long NeighborAdvertisementsReceived { get; } public abstract long NeighborAdvertisementsSent { get; } @@ -103,7 +135,9 @@ namespace System.Net.NetworkInformation { protected IPAddressInformation() { } public abstract System.Net.IPAddress Address { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract bool IsDnsEligible { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract bool IsTransient { get; } } public partial class IPAddressInformationCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable @@ -123,37 +157,41 @@ namespace System.Net.NetworkInformation public abstract partial class IPGlobalProperties { protected IPGlobalProperties() { } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract string DhcpScopeName { get; } public abstract string DomainName { get; } public abstract string HostName { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract bool IsWinsProxy { get; } public abstract System.Net.NetworkInformation.NetBiosNodeType NodeType { get; } public virtual System.IAsyncResult BeginGetUnicastAddresses(System.AsyncCallback? callback, object? state) { throw null; } public virtual System.Net.NetworkInformation.UnicastIPAddressInformationCollection EndGetUnicastAddresses(System.IAsyncResult asyncResult) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.NetworkInformation.TcpConnectionInformation[] GetActiveTcpConnections(); - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.IPEndPoint[] GetActiveTcpListeners(); - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.IPEndPoint[] GetActiveUdpListeners(); - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.NetworkInformation.IcmpV4Statistics GetIcmpV4Statistics(); - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.NetworkInformation.IcmpV6Statistics GetIcmpV6Statistics(); - [System.Runtime.Versioning.UnsupportedOSPlatform("illumos")] - [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("illumos")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("solaris")] public static System.Net.NetworkInformation.IPGlobalProperties GetIPGlobalProperties() { throw null; } public abstract System.Net.NetworkInformation.IPGlobalStatistics GetIPv4GlobalStatistics(); + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract System.Net.NetworkInformation.IPGlobalStatistics GetIPv6GlobalStatistics(); - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.NetworkInformation.TcpStatistics GetTcpIPv4Statistics(); - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.NetworkInformation.TcpStatistics GetTcpIPv6Statistics(); - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.NetworkInformation.UdpStatistics GetUdpIPv4Statistics(); - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.NetworkInformation.UdpStatistics GetUdpIPv6Statistics(); public virtual System.Net.NetworkInformation.UnicastIPAddressInformationCollection GetUnicastAddresses() { throw null; } public virtual System.Threading.Tasks.Task GetUnicastAddressesAsync() { throw null; } @@ -161,69 +199,81 @@ namespace System.Net.NetworkInformation public abstract partial class IPGlobalStatistics { protected IPGlobalStatistics() { } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract int DefaultTtl { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract bool ForwardingEnabled { get; } public abstract int NumberOfInterfaces { get; } public abstract int NumberOfIPAddresses { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract int NumberOfRoutes { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long OutputPacketRequests { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long OutputPacketRoutingDiscards { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long OutputPacketsDiscarded { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long OutputPacketsWithNoRoute { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long PacketFragmentFailures { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long PacketReassembliesRequired { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long PacketReassemblyFailures { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long PacketReassemblyTimeout { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long PacketsFragmented { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long PacketsReassembled { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long ReceivedPackets { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long ReceivedPacketsDelivered { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long ReceivedPacketsDiscarded { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long ReceivedPacketsForwarded { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long ReceivedPacketsWithAddressErrors { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long ReceivedPacketsWithHeadersErrors { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract long ReceivedPacketsWithUnknownProtocol { get; } } public abstract partial class IPInterfaceProperties { protected IPInterfaceProperties() { } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract System.Net.NetworkInformation.IPAddressInformationCollection AnycastAddresses { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract System.Net.NetworkInformation.IPAddressCollection DhcpServerAddresses { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.NetworkInformation.IPAddressCollection DnsAddresses { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract string DnsSuffix { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public abstract System.Net.NetworkInformation.GatewayIPAddressInformationCollection GatewayAddresses { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract bool IsDnsEnabled { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract bool IsDynamicDnsEnabled { get; } public abstract System.Net.NetworkInformation.MulticastIPAddressInformationCollection MulticastAddresses { get; } public abstract System.Net.NetworkInformation.UnicastIPAddressInformationCollection UnicastAddresses { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract System.Net.NetworkInformation.IPAddressCollection WinsServersAddresses { get; } public abstract System.Net.NetworkInformation.IPv4InterfaceProperties GetIPv4Properties(); public abstract System.Net.NetworkInformation.IPv6InterfaceProperties GetIPv6Properties(); @@ -235,13 +285,15 @@ namespace System.Net.NetworkInformation public abstract long BytesSent { get; } public abstract long IncomingPacketsDiscarded { get; } public abstract long IncomingPacketsWithErrors { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("linux")] public abstract long IncomingUnknownProtocolPackets { get; } public abstract long NonUnicastPacketsReceived { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("linux")] public abstract long NonUnicastPacketsSent { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("osx")] - [System.Runtime.Versioning.UnsupportedOSPlatform("ios")] - [System.Runtime.Versioning.UnsupportedOSPlatform("tvos")] - [System.Runtime.Versioning.UnsupportedOSPlatform("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long OutgoingPacketsDiscarded { get; } public abstract long OutgoingPacketsWithErrors { get; } public abstract long OutputQueueLength { get; } @@ -252,16 +304,18 @@ namespace System.Net.NetworkInformation { protected IPv4InterfaceProperties() { } public abstract int Index { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract bool IsAutomaticPrivateAddressingActive { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract bool IsAutomaticPrivateAddressingEnabled { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract bool IsDhcpEnabled { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")] public abstract bool IsForwardingEnabled { get; } public abstract int Mtu { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")] public abstract bool UsesWins { get; } } public abstract partial class IPv4InterfaceStatistics @@ -274,10 +328,10 @@ namespace System.Net.NetworkInformation public abstract long IncomingUnknownProtocolPackets { get; } public abstract long NonUnicastPacketsReceived { get; } public abstract long NonUnicastPacketsSent { get; } - [System.Runtime.Versioning.UnsupportedOSPlatform("osx")] - [System.Runtime.Versioning.UnsupportedOSPlatform("ios")] - [System.Runtime.Versioning.UnsupportedOSPlatform("tvos")] - [System.Runtime.Versioning.UnsupportedOSPlatform("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public abstract long OutgoingPacketsDiscarded { get; } public abstract long OutgoingPacketsWithErrors { get; } public abstract long OutputQueueLength { get; } @@ -289,16 +343,26 @@ namespace System.Net.NetworkInformation protected IPv6InterfaceProperties() { } public abstract int Index { get; } public abstract int Mtu { get; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public virtual long GetScopeId(System.Net.NetworkInformation.ScopeLevel scopeLevel) { throw null; } } public abstract partial class MulticastIPAddressInformation : System.Net.NetworkInformation.IPAddressInformation { protected MulticastIPAddressInformation() { } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract long AddressPreferredLifetime { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract long AddressValidLifetime { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract long DhcpLeaseLifetime { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract System.Net.NetworkInformation.DuplicateAddressDetectionState DuplicateAddressDetectionState { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract System.Net.NetworkInformation.PrefixOrigin PrefixOrigin { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract System.Net.NetworkInformation.SuffixOrigin SuffixOrigin { get; } } public partial class MulticastIPAddressInformationCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable @@ -335,11 +399,11 @@ namespace System.Net.NetworkInformation [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] public NetworkChange() { } - [System.Runtime.Versioning.UnsupportedOSPlatform("illumos")] - [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("illumos")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("solaris")] public static event System.Net.NetworkInformation.NetworkAddressChangedEventHandler? NetworkAddressChanged { add { } remove { } } - [System.Runtime.Versioning.UnsupportedOSPlatform("illumos")] - [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("illumos")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("solaris")] public static event System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler? NetworkAvailabilityChanged { add { } remove { } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] @@ -357,28 +421,28 @@ namespace System.Net.NetworkInformation protected NetworkInterface() { } public virtual string Description { get { throw null; } } public virtual string Id { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatform("illumos")] - [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("illumos")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("solaris")] public static int IPv6LoopbackInterfaceIndex { get { throw null; } } public virtual bool IsReceiveOnly { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatform("illumos")] - [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("illumos")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("solaris")] public static int LoopbackInterfaceIndex { get { throw null; } } public virtual string Name { get { throw null; } } public virtual System.Net.NetworkInformation.NetworkInterfaceType NetworkInterfaceType { get { throw null; } } public virtual System.Net.NetworkInformation.OperationalStatus OperationalStatus { get { throw null; } } public virtual long Speed { get { throw null; } } public virtual bool SupportsMulticast { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatform("illumos")] - [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("illumos")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("solaris")] public static System.Net.NetworkInformation.NetworkInterface[] GetAllNetworkInterfaces() { throw null; } public virtual System.Net.NetworkInformation.IPInterfaceProperties GetIPProperties() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public virtual System.Net.NetworkInformation.IPInterfaceStatistics GetIPStatistics() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatform("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] public virtual System.Net.NetworkInformation.IPv4InterfaceStatistics GetIPv4Statistics() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatform("illumos")] - [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("illumos")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("solaris")] public static bool GetIsNetworkAvailable() { throw null; } public virtual System.Net.NetworkInformation.PhysicalAddress GetPhysicalAddress() { throw null; } public virtual bool Supports(System.Net.NetworkInformation.NetworkInterfaceComponent networkInterfaceComponent) { throw null; } @@ -433,14 +497,14 @@ namespace System.Net.NetworkInformation { public static readonly System.Net.NetworkInformation.PhysicalAddress None; public PhysicalAddress(byte[] address) { } - public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] object? comparand) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? comparand) { throw null; } public byte[] GetAddressBytes() { throw null; } public override int GetHashCode() { throw null; } + public static System.Net.NetworkInformation.PhysicalAddress Parse(System.ReadOnlySpan address) { throw null; } public static System.Net.NetworkInformation.PhysicalAddress Parse(string? address) { throw null; } - public static System.Net.NetworkInformation.PhysicalAddress Parse(ReadOnlySpan address) { throw null; } - public static bool TryParse(string? address, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Net.NetworkInformation.PhysicalAddress? value) { throw null; } - public static bool TryParse(ReadOnlySpan address, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Net.NetworkInformation.PhysicalAddress? value) { throw null; } public override string ToString() { throw null; } + public static bool TryParse(System.ReadOnlySpan address, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Net.NetworkInformation.PhysicalAddress? value) { throw null; } + public static bool TryParse(string? address, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Net.NetworkInformation.PhysicalAddress? value) { throw null; } } public enum PrefixOrigin { @@ -523,13 +587,19 @@ namespace System.Net.NetworkInformation public abstract partial class UnicastIPAddressInformation : System.Net.NetworkInformation.IPAddressInformation { protected UnicastIPAddressInformation() { } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract long AddressPreferredLifetime { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract long AddressValidLifetime { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract long DhcpLeaseLifetime { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract System.Net.NetworkInformation.DuplicateAddressDetectionState DuplicateAddressDetectionState { get; } public abstract System.Net.IPAddress IPv4Mask { get; } public virtual int PrefixLength { get { throw null; } } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract System.Net.NetworkInformation.PrefixOrigin PrefixOrigin { get; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public abstract System.Net.NetworkInformation.SuffixOrigin SuffixOrigin { get; } } public partial class UnicastIPAddressInformationCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPAddressInformation.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPAddressInformation.cs index 9369864..87d0f7d 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPAddressInformation.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPAddressInformation.cs @@ -1,6 +1,8 @@ // 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.NetworkInformation { /// @@ -16,11 +18,13 @@ namespace System.Net.NetworkInformation /// /// Gets a bool value that indicates whether the Internet Protocol (IP) address is legal to appear in a Domain Name System (DNS) server database. /// + [SupportedOSPlatform("windows")] public abstract bool IsDnsEligible { get; } /// /// Gets a bool value that indicates whether the Internet Protocol (IP) address is transient. /// + [SupportedOSPlatform("windows")] public abstract bool IsTransient { get; } } } diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs index 1371a47d..1a78c1d 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs @@ -106,6 +106,10 @@ namespace System.Net.NetworkInformation /// public abstract IPGlobalStatistics GetIPv4GlobalStatistics(); + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract IPGlobalStatistics GetIPv6GlobalStatistics(); public virtual UnicastIPAddressInformationCollection GetUnicastAddresses() diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs index 863737c..33aa2ae 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs @@ -15,6 +15,10 @@ namespace System.Net.NetworkInformation /// Gets a bool value that indicates whether this interface is configured to send name resolution queries to a Domain Name System (DNS) server. /// [UnsupportedOSPlatform("android")] + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract bool IsDnsEnabled { get; } /// @@ -26,7 +30,7 @@ namespace System.Net.NetworkInformation /// /// Gets a bool value that indicates whether this interface is configured to automatically register its IP address information with the Domain Name System (DNS). /// - [UnsupportedOSPlatform("android")] + [SupportedOSPlatform("windows")] public abstract bool IsDynamicDnsEnabled { get; } /// @@ -42,7 +46,7 @@ namespace System.Net.NetworkInformation /// /// The address identifies multiple computers. Packets sent to an anycast address are sent to one of the computers identified by the address. /// - [UnsupportedOSPlatform("android")] + [SupportedOSPlatform("windows")] public abstract IPAddressInformationCollection AnycastAddresses { get; } /// @@ -61,12 +65,20 @@ namespace System.Net.NetworkInformation /// Gets the addresses for Dynamic Host Configuration Protocol (DHCP) servers. /// [UnsupportedOSPlatform("android")] + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract IPAddressCollection DhcpServerAddresses { get; } /// /// Gets the list of Wins Servers registered with this interface /// [UnsupportedOSPlatform("android")] + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract IPAddressCollection WinsServersAddresses { get; } /// diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceStatistics.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceStatistics.cs index 4570a7b..85e5ef2 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceStatistics.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceStatistics.cs @@ -34,6 +34,7 @@ namespace System.Net.NetworkInformation /// /// Gets the number of incoming packets with an unknown protocol. /// + [UnsupportedOSPlatform("linux")] public abstract long IncomingUnknownProtocolPackets { get; } /// @@ -44,6 +45,7 @@ namespace System.Net.NetworkInformation /// /// Gets the number of non-unicast packets sent on the interface. /// + [UnsupportedOSPlatform("linux")] public abstract long NonUnicastPacketsSent { get; } /// diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs index 9f9d0b1..687902f 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs @@ -13,25 +13,26 @@ namespace System.Net.NetworkInformation /// /// Gets a bool value that indicates whether an interface uses Windows Internet Name Service (WINS). /// - [UnsupportedOSPlatform("android")] + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] public abstract bool UsesWins { get; } /// /// Gets a bool value that indicates whether the interface is configured to use a dynamic host configuration protocol (DHCP) server to obtain an IP address. /// - [UnsupportedOSPlatform("android")] + [SupportedOSPlatform("windows")] public abstract bool IsDhcpEnabled { get; } /// /// Gets a bool value that indicates whether this interface has an automatic private IP addressing (APIPA) address. /// - [UnsupportedOSPlatform("android")] + [SupportedOSPlatform("windows")] public abstract bool IsAutomaticPrivateAddressingActive { get; } /// /// Gets a bool value that indicates whether this interface has automatic private IP addressing (APIPA) enabled. /// - [UnsupportedOSPlatform("android")] + [SupportedOSPlatform("windows")] public abstract bool IsAutomaticPrivateAddressingEnabled { get; } /// @@ -42,7 +43,8 @@ namespace System.Net.NetworkInformation /// /// Gets a bool value that indicates whether this interface can route packets. /// - [UnsupportedOSPlatform("android")] + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] public abstract bool IsForwardingEnabled { get; } /// diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv6InterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv6InterfaceProperties.cs index 534ac51..1e64760 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv6InterfaceProperties.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv6InterfaceProperties.cs @@ -1,6 +1,8 @@ // 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.NetworkInformation { /// @@ -23,6 +25,10 @@ namespace System.Net.NetworkInformation /// /// The scope level. /// The IPv6 scope identifier. + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public virtual long GetScopeId(ScopeLevel scopeLevel) { throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException); diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IcmpV4Statistics.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IcmpV4Statistics.cs index 2d677ef..482db58 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IcmpV4Statistics.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IcmpV4Statistics.cs @@ -1,6 +1,8 @@ // 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.NetworkInformation { /// @@ -61,21 +63,37 @@ namespace System.Net.NetworkInformation /// /// Gets the number of Internet Control Message Protocol version 4 (ICMPv4) error messages received. /// + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract long ErrorsReceived { get; } /// /// Gets the number of Internet Control Message Protocol version 4 (ICMPv4) Echo Request messages sent. /// + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract long ErrorsSent { get; } /// /// Gets the number of Internet Control Message Protocol messages received. /// + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract long MessagesReceived { get; } /// /// Gets the number of Internet Control Message Protocol version 4 (ICMPv4) messages sent. /// + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract long MessagesSent { get; } /// diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IcmpV6Statistics.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IcmpV6Statistics.cs index 6f9d3e7..be51f70 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IcmpV6Statistics.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IcmpV6Statistics.cs @@ -1,6 +1,8 @@ // 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.NetworkInformation { /// @@ -41,11 +43,19 @@ namespace System.Net.NetworkInformation /// /// Gets the number of Internet Control Message Protocol version 6 (ICMPv6) error messages received. /// + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract long ErrorsReceived { get; } /// /// Gets the number of Internet Control Message Protocol version 6 (ICMPv6) error messages sent. /// + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract long ErrorsSent { get; } /// @@ -81,11 +91,19 @@ namespace System.Net.NetworkInformation /// /// Gets the number of Internet Control Message Protocol version 6 (ICMPv6) messages received. /// + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract long MessagesReceived { get; } /// /// Gets the number of Internet Control Message Protocol version 6 (ICMPv6) messages sent. /// + [UnsupportedOSPlatform("osx")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [UnsupportedOSPlatform("freebsd")] public abstract long MessagesSent { get; } /// diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/MulticastIPAddressInformation.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/MulticastIPAddressInformation.cs index 9dfe8b5..c16aae4 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/MulticastIPAddressInformation.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/MulticastIPAddressInformation.cs @@ -1,6 +1,8 @@ // 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.NetworkInformation { /// @@ -11,31 +13,37 @@ namespace System.Net.NetworkInformation /// /// Gets the number of seconds remaining during which this address is the preferred address. /// + [SupportedOSPlatform("windows")] public abstract long AddressPreferredLifetime { get; } /// /// Gets the number of seconds remaining during which this address is valid. /// + [SupportedOSPlatform("windows")] public abstract long AddressValidLifetime { get; } /// /// Specifies the amount of time remaining on the Dynamic Host Configuration Protocol (DHCP) lease for this IP address. /// + [SupportedOSPlatform("windows")] public abstract long DhcpLeaseLifetime { get; } /// /// Gets a value that indicates the state of the duplicate address detection algorithm. /// + [SupportedOSPlatform("windows")] public abstract DuplicateAddressDetectionState DuplicateAddressDetectionState { get; } /// /// Gets a value that identifies the source of a unicast IP address prefix. /// + [SupportedOSPlatform("windows")] public abstract PrefixOrigin PrefixOrigin { get; } /// /// Gets a value that identifies the source of a unicast IP address suffix. /// + [SupportedOSPlatform("windows")] public abstract SuffixOrigin SuffixOrigin { get; } } } diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnicastIPAddressInformation.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnicastIPAddressInformation.cs index 13199b9..139dcc4 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnicastIPAddressInformation.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnicastIPAddressInformation.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Net.Sockets; +using System.Runtime.Versioning; namespace System.Net.NetworkInformation { @@ -14,31 +15,37 @@ namespace System.Net.NetworkInformation /// /// Gets the number of seconds remaining during which this address is the preferred address. /// + [SupportedOSPlatform("windows")] public abstract long AddressPreferredLifetime { get; } /// /// Gets the number of seconds remaining during which this address is valid. /// + [SupportedOSPlatform("windows")] public abstract long AddressValidLifetime { get; } /// /// Specifies the amount of time remaining on the Dynamic Host Configuration Protocol (DHCP) lease for this IP address. /// + [SupportedOSPlatform("windows")] public abstract long DhcpLeaseLifetime { get; } /// /// Gets a value that indicates the state of the duplicate address detection algorithm. /// + [SupportedOSPlatform("windows")] public abstract DuplicateAddressDetectionState DuplicateAddressDetectionState { get; } /// /// Gets a value that identifies the source of a unicast IP address prefix. /// + [SupportedOSPlatform("windows")] public abstract PrefixOrigin PrefixOrigin { get; } /// /// Gets a value that identifies the source of a unicast IP address suffix. /// + [SupportedOSPlatform("windows")] public abstract SuffixOrigin SuffixOrigin { get; } public abstract IPAddress IPv4Mask { get; } -- 2.7.4