-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Description
We have a project using following function call:
var isNetworkAvailable = NetworkInterface.GetIsNetworkAvailable();
On a Win11 LTSC (W11 IoT Enterprise LTSC) test unit with no network connection (Ethernet cable unplugged and Wi-Fi not connected).
When the project is built with .NET 8.0, the function GetIsNetworkAvailable() returns false.
When the project is built with .NET 9.0, the function GetIsNetworkAvailable() returns true.
Here is Microsoft support's explanation on why GetIsNetworkAvailable() behaves differently depending on .NET version:
https://learn.microsoft.com/en-gb/answers/questions/5763874/getisnetworkavailable()-behaves-differently-depend
We like to keep the function behavior of .NET 8.0 when building the project with .NET 9.0. Is there any equivalent code to replace the function GetIsNetworkAvailable()? Or, This is a bug that will be fixed in a later version. Thanks.
Reproduction Steps
var isNetworkAvailable = NetworkInterface.GetIsNetworkAvailable();
On a Win11 LTSC (W11 IoT Enterprise LTSC) test unit with no network connection (Ethernet cable unplugged and Wi-Fi not connected).
When the project is built with .NET 8.0, the function GetIsNetworkAvailable() returns false.
When the project is built with .NET 9.0, the function GetIsNetworkAvailable() returns true.
Expected behavior
On a Win11 LTSC (W11 IoT Enterprise LTSC) test unit with no network connection (Ethernet cable unplugged and Wi-Fi not connected).
When the project is built with .NET 9.0, the function GetIsNetworkAvailable() returns false.
Actual behavior
On a Win11 LTSC (W11 IoT Enterprise LTSC) test unit with no network connection (Ethernet cable unplugged and Wi-Fi not connected).
When the project is built with .NET 9.0, the function GetIsNetworkAvailable() returns true.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response