Skip to content

[Android] NetworkInterface.GetAllNetworkInterfaces failed with NetworkInformationException (message: Success) #75809

@8212369

Description

@8212369

Description

On Android 11 release build, I was encountering System.Net.NetworkInformation.NetworkInformationException when called System.Net.NetworkInformation.NetworkInterface。GetAllNetworkInterfaces, and the error string is just success. I have added two permissions: INTERNET and ACCESS_NETWORK_STATE to which no avail. I think it's worth mentioning.

I saw a log category named DOTNET_LINK so I reported the issue here.

Reproduction Steps

Using System.Net namespace, call NetworkInterface.GetAllNetworkInterfaces

Expected behavior

The function completes with no exception

Actual behavior

The function throws System.Net.NetworkInformationException

image

Regression?

No response

Known Workarounds

No response

Configuration

.NET 6.0.9

Other information

I skimmed through the PRs and there was a change to exclusively use the Xamarin's implementation of getifaddrs recently. But on Android 11 Google blocked NETLINK_ROUTE family socket from being bind.

This is also the log that I was getting from adb

image

I think it's correspond to this. I hope I'm right.

One small note, I think this quirk is per vendor distribution, as my Xiaomi phone does not seems have this problem.

Related issues about this blocking .

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions