runtime: [dotnet-sdk-9.0.100-preview.4.24253.11] IPInterfaceProperties.GatewayAddresses. FirstOrDefault() returns Null

Description

when we run OpenNetMeter app with 9.0.100-preview.5.24227.1 or higher version. It will show error: GatewayAddresses is NULL.

Application Name: OpenNetMeter OS:Windows 10 21H2 CPU:AMD64 .NET Build Number: dotnet-sdk-9.0.100-preview.5.24227.1

App or source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2049203

Github Link: https://github.com/Ashfaaq18/OpenNetMeter

Reproduction Steps

Test Steps for the Application:

1.Launch app from folder “OpenNetMeter.exe".

Expected Result: Show detailed data service successfully. Actual Result: App is in Disconnected State, nothing appears.

Minimal Repro steps:(Demo AttachedConsoleApp12.zip) 1)Create .NET Console App 2) Add this code

 NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
 foreach (NetworkInterface n in adapters)
 {
     IPInterfaceProperties adapterProperties = n.GetIPProperties();
     try
     {
       
         Console.WriteLine($"{n.Id} {n.Name} {n.Description} GatewayAddresses is {adapterProperties.GatewayAddresses.FirstOrDefault().Address}");
     }
     catch (System.NullReferenceException)
     {
         //in .NET 9.0.100-preview.5.24227.1, it always come to this line because GatewayAddresses is always NULL
         Console.WriteLine($"{n.Id} {n.Name} {n.Description} GatewayAddresses is NULLL");
     }
 }
  1. Build the app and change the runtime to .NET 9.0:
"framework": {
     "name": "Microsoft.NETCore.App",
           "version": "9.0.0-preview.4.24225.8"
   }
  1. Run the app .

Expected behavior

App run successfully without error.

Actual behavior

Show error: GatewayAddresses returns NULL

Regression?

Yes

Verify Scenarios:

1). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.5.24227.1: Fail 2). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.4.24223.3: Pass 3). Windows 10 21H2 AMD64 + dotnet-sdk-8.0.300-win-x64: Pass 4). Windows 10 21H2 AMD64 + dotnet-sdk- 7.0.306-win-x64: Pass 5). Windows 10 21H2 AMD64 + dotnet-sdk-6.0.422-win-x64: Pass 6). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.4.24253.11: Fail

Did it work in .NET Framework? Yes

Known Workarounds

No response

Configuration

dotnet info:

dotnet --info
.NET SDK:
 Version:           9.0.100-preview.5.24227.1
 Commit:            0f7644da23
 Workload version:  9.0.100-manifests.f3024191
 MSBuild version:   17.11.0-preview-24223-07+d542f3a80

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.100-preview.5.24227.1\

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      9.0.0-preview.4.24225.8
  Architecture: x64
  Commit:       74d927967d

.NET SDKs installed:
  9.0.100-preview.5.24227.1 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-preview.4.24223.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0-preview.4.24225.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 9.0.0-preview.5.24226.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Other information

Finding: After debugging the app, we find out that IPInterfaceProperties.GatewayAddresses Property returns NULL, app stays in Disconneted State , in earlier Runtimes, we get value of GatewayAddresses

@dotnet-actwx-bot @dotnet/compat

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (21 by maintainers)

Most upvoted comments

Verified with dotnet-sdk-9.0.100-preview.6.24307.18, this issue has been fixed.

It will be in next public preview 6 for sure. I did look at current daily builds (.version file)

3750ac51619efbbc59bf07d3879758a9c18c4b0e
9.0.0-preview.6.24281.1

that commit is (barely) older than https://github.com/dotnet/runtime/commit/ead1d5c8104e7275f98c71bb858c09c61c0c68f6 that fix the issue. I have no visibility to when SDK will pick up dated runtime again. But it seems like there is no build yet with the fix.