From 274a3e2dc40b455068b3c915cc99b4bc2dec3db5 Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Thu, 6 Mar 2025 23:36:47 +0100 Subject: [PATCH 1/3] GetIPv4Properties never returns null --- .../NCLNetInfo2/CPP/networkexamples.cpp | 5 ----- .../Overview/networkexamples.cs | 6 ------ .../VS_Snippets_Remoting/NCLNetInfo2/VB/networkexamples.vb | 6 +----- xml/System.Net.NetworkInformation/IPInterfaceProperties.xml | 6 ++++-- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp index 2a2ee1dc16b..210b727cdc0 100644 --- a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp @@ -836,11 +836,6 @@ void DisplayIPv4NetworkInterfaces() // Try to get the IPv4 interface properties. IPv4InterfaceProperties ^ p = adapterProperties->GetIPv4Properties(); - if ( !p ) - { - Console::WriteLine( "No IPv4 information is available for this interface." ); - continue; - } // Display the IPv4 specific data. Console::WriteLine( " Index ............................. : {0}", diff --git a/snippets/csharp/System.Net.NetworkInformation/DuplicateAddressDetectionState/Overview/networkexamples.cs b/snippets/csharp/System.Net.NetworkInformation/DuplicateAddressDetectionState/Overview/networkexamples.cs index 9c6b672328b..8cc9ce5ed92 100644 --- a/snippets/csharp/System.Net.NetworkInformation/DuplicateAddressDetectionState/Overview/networkexamples.cs +++ b/snippets/csharp/System.Net.NetworkInformation/DuplicateAddressDetectionState/Overview/networkexamples.cs @@ -796,12 +796,6 @@ public static void DisplayIPv4NetworkInterfaces() // Try to get the IPv4 interface properties. IPv4InterfaceProperties p = adapterProperties.GetIPv4Properties(); - if (p == null) - { - Console.WriteLine("No IPv4 information is available for this interface."); - Console.WriteLine(); - continue; - } // Display the IPv4 specific data. Console.WriteLine(" Index ............................. : {0}", p.Index); Console.WriteLine(" MTU ............................... : {0}", p.Mtu); diff --git a/snippets/visualbasic/VS_Snippets_Remoting/NCLNetInfo2/VB/networkexamples.vb b/snippets/visualbasic/VS_Snippets_Remoting/NCLNetInfo2/VB/networkexamples.vb index 30e67a10ba5..867a2dbadd4 100644 --- a/snippets/visualbasic/VS_Snippets_Remoting/NCLNetInfo2/VB/networkexamples.vb +++ b/snippets/visualbasic/VS_Snippets_Remoting/NCLNetInfo2/VB/networkexamples.vb @@ -695,11 +695,7 @@ Public Class NetworkingExample Dim adapterProperties As IPInterfaceProperties = adapter.GetIPProperties() ' Try to get the IPv4 interface properties. Dim p As IPv4InterfaceProperties = adapterProperties.GetIPv4Properties() - - If p Is Nothing Then - Console.WriteLine("No IPv4 information is available for this interface.") - GoTo ContinueForEach1 - End If + ' Display the IPv4 specific data. Console.WriteLine(" Index ............................. : {0}", p.Index) Console.WriteLine(" MTU ............................... : {0}", p.Mtu) diff --git a/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml b/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml index e9d07e9b728..ba92cc18131 100644 --- a/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml +++ b/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml @@ -494,7 +494,8 @@ ## Remarks For a detailed description of the information available for an interface that supports IPv4, see the class documentation. Note that the object returned by the method reflects the configuration as of the time the object is created. This information is not updated dynamically. - + A is thrown if the interface does not support the IPv4 protocol, therefore it's recommended to check IPv4 support calling on the originating instance before querying the IPv4 properties. + ]]> The interface does not support the IPv4 protocol. @@ -544,7 +545,8 @@ ## Remarks For a detailed description of the information available for an interface that supports IPv6, see the documentation. Note that the object returned by the method reflects the configuration as of the time the object is created. This information is not updated dynamically. - + A is thrown if the interface does not support the IPv6 protocol, therefore it's recommended to check IPv6 support calling on the originating instance before querying the IPv6 properties. + ]]> The interface does not support the IPv6 protocol. From ebb4ba2d10ea59907d433e183d9194492953d003 Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Fri, 7 Mar 2025 00:38:49 +0100 Subject: [PATCH 2/3] oops --- xml/System.Net.NetworkInformation/IPInterfaceProperties.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml b/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml index ba92cc18131..809fc6a73ef 100644 --- a/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml +++ b/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml @@ -494,7 +494,7 @@ ## Remarks For a detailed description of the information available for an interface that supports IPv4, see the class documentation. Note that the object returned by the method reflects the configuration as of the time the object is created. This information is not updated dynamically. - A is thrown if the interface does not support the IPv4 protocol, therefore it's recommended to check IPv4 support calling on the originating instance before querying the IPv4 properties. + A is thrown if the interface does not support the IPv4 protocol, therefore it's recommended to check IPv4 support calling on the originating instance before querying the IPv4 properties. ]]> @@ -545,7 +545,7 @@ ## Remarks For a detailed description of the information available for an interface that supports IPv6, see the documentation. Note that the object returned by the method reflects the configuration as of the time the object is created. This information is not updated dynamically. - A is thrown if the interface does not support the IPv6 protocol, therefore it's recommended to check IPv6 support calling on the originating instance before querying the IPv6 properties. + A is thrown if the interface does not support the IPv6 protocol, therefore it's recommended to check IPv6 support calling on the originating instance before querying the IPv6 properties. ]]> From 2f1f6212e14332bed1690600e7b281ddb1099a87 Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Fri, 7 Mar 2025 17:17:22 +0100 Subject: [PATCH 3/3] use xref --- xml/System.Net.NetworkInformation/IPInterfaceProperties.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml b/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml index 809fc6a73ef..d85efc8d377 100644 --- a/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml +++ b/xml/System.Net.NetworkInformation/IPInterfaceProperties.xml @@ -494,7 +494,7 @@ ## Remarks For a detailed description of the information available for an interface that supports IPv4, see the class documentation. Note that the object returned by the method reflects the configuration as of the time the object is created. This information is not updated dynamically. - A is thrown if the interface does not support the IPv4 protocol, therefore it's recommended to check IPv4 support calling on the originating instance before querying the IPv4 properties. + A is thrown if the interface does not support the IPv4 protocol, therefore it's recommended to check IPv4 support calling on the originating instance before querying the IPv4 properties. ]]> @@ -545,7 +545,7 @@ ## Remarks For a detailed description of the information available for an interface that supports IPv6, see the documentation. Note that the object returned by the method reflects the configuration as of the time the object is created. This information is not updated dynamically. - A is thrown if the interface does not support the IPv6 protocol, therefore it's recommended to check IPv6 support calling on the originating instance before querying the IPv6 properties. + A is thrown if the interface does not support the IPv6 protocol, therefore it's recommended to check IPv6 support calling on the originating instance before querying the IPv6 properties. ]]>