You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DnsResolver cannot discover system DNS servers on Android #132212
DnsResolver (and Dns.Resolve*) is now implemented on all Unix-like platforms by the managed stub resolver in DnsResolverPal.Managed.cs, which is compiled for the -unix TFM and therefore also ships on Android.
When DnsResolverOptions.Servers is empty, the managed resolver obtains the system DNS servers from /etc/resolv.conf via ResolvConf.GetNameServers(). Android has no readable resolver configuration, so this returns an empty list and GetServers() falls back to 127.0.0.1:53:
The result is that every query issued by a default-constructed DnsResolver times out on Android.
This is the same underlying gap that makes IPInterfaceProperties.DnsAddresses throw PlatformNotSupportedException on Android (see AndroidIPInterfaceProperties and the corresponding assertion in IPInterfacePropertiesTest_Android.cs).
Note that this only affects the system-configured server path. Callers that supply DnsResolverOptions.Servers explicitly work fine on Android.
Suggested fix
Add an Android-specific source for the system DNS servers, e.g.:
ConnectivityManager.getLinkProperties(activeNetwork).getDnsServers() through the Android interop layer, or
the net.dns1 / net.dns2 system properties via __system_property_get (legacy, unavailable to non-privileged apps on newer API levels), or
android_res_nsend / the NDK resolver API.
Test impact
The network tests in DnsResolverTest are currently gated with PlatformDetection.IsNotAndroid for this reason. DnsResolverLoopbackTest is unaffected because it passes explicit servers, and does run on Android.
Activity
dotnet-policy-service commentedon Aug 12, 2026
Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.
Enable DnsResolver tests on all Unix platforms (#132216)