Skip to content

NetworkInterface.GetAllNetworkInterfaces() different behaviour in .net 9 / 10 comapred to .net 8 and earlier #122751

@BornToBeRoot

Description

@BornToBeRoot

Description

Hi,

the NetworkInterface.GetAllNetworkInterfaces() has a different behaviour in .net 9 & .net 10 compared to earlier .net versions (.net 8 and lower).

It will return a lot of adapters that are not listed in ipconfig, ncpa.cpl or Get-NetAdapter, it looks like this are properties that can be configured of the real adapters. It also not possible to filter out the adpaters because they are from the type ethernet or wireless.

Image

Reproduction Steps

using System.Net.NetworkInformation;

Console.WriteLine(".NET Version: " + Environment.Version+ "\n");

Console.WriteLine("NetworkInterface.GetAllNetworkInterfaces()\n\n");

foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces())
{
    Console.WriteLine($"Name: {adapter.Name}");        
}

Compiled for .net 8 / 9 / 10

Expected behavior

Output should be the same as 8 and before. I don't think this are real adapters? At least they are not listed anywhere in the other tools....

Actual behavior

See screenshot above

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

Maybe related to this: #89990 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.NetuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions