Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Net.NetworkInformation needs Android PAL #51303

Closed
marek-safar opened this issue Apr 15, 2021 · 7 comments · Fixed by #63633
Closed

System.Net.NetworkInformation needs Android PAL #51303

marek-safar opened this issue Apr 15, 2021 · 7 comments · Fixed by #63633

Comments

@marek-safar
Copy link
Contributor

marek-safar commented Apr 15, 2021

Currently, System.Net.NetworkInformation implementation on Android falls back to Linux PAL. This needs to change because starting from API 24 Android restricts access to many files in the /sys filesystem which makes the API unsupported.

Right now the APIs fail with System.UnauthorizedAccessException. We need to write an Android-specific PAL layer that uses Java APIs via JNI to access the information to not break developers migrating from existing Mono based BCL.

/cc @steveisok

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net untriaged New issue has not been triaged by the area owner labels Apr 15, 2021
@ghost
Copy link

ghost commented Apr 15, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Currently, System.Net.NetworkInformation implementation on Android falls back to Linux PAL. This needs to change because starting from API 24 Android restricts access to many files in the /sys filesystem which makes the API unsupported.

We should write Android-specific PAL layer which uses Java APIs via JNI to access the information.

/cc @steveisok

Author: marek-safar
Assignees: -
Labels:

area-System.Net, untriaged

Milestone: -

@filipnavara
Copy link
Member

For reference, the Xamarin.Android implementation of the code resides here. Mono used to call it through several indirections.

@wfurt
Copy link
Member

wfurt commented Apr 20, 2021

It would be good to get list of failing methods & properties @marek-safar. I made changes in the past to linked GetAllNetworkInterfaces() do depend less on /proc & /sys. It certainly feels better to throw PNSP or have alternative implementation than getting access violation. I would be curious to see how big that difference is.

@marek-safar
Copy link
Contributor Author

@wfurt see #50567

@wfurt
Copy link
Member

wfurt commented Apr 21, 2021

That list does not give the list of files @marek-safar. But it seems to be mostly stats.

@marek-safar
Copy link
Contributor Author

@wfurt perhaps I misunderstood the ask, what are you looking for exactly?

@wfurt
Copy link
Member

wfurt commented Apr 22, 2021

That is ok. I was primarily wondering how much code we will need to replace. Number of test is somewhat approximation. If there are only few functions we may simply add alternatives instead of doing whole new pal. there is already some precedent for that.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants