Skip to content

Re-enable localhost loopback assertions on Apple mobile and Android#128480

Closed
Copilot wants to merge 2 commits into
mainfrom
copilot/name-resolution-tests-fix
Closed

Re-enable localhost loopback assertions on Apple mobile and Android#128480
Copilot wants to merge 2 commits into
mainfrom
copilot/name-resolution-tests-fix

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

The *Localhost* NameResolution tests were guarded by requireLoopback = !PlatformDetection.IsAppleMobile && !PlatformDetection.IsAndroid, which skipped the loopback assertions on those platforms. The underlying resolver issue was addressed by #128068, so these gates can be removed to surface any remaining regressions.

  • GetHostAddressesTest.cs: drop the requireLoopback gate in DnsGetHostAddresses_LocalhostSubdomain_ReturnsLoopback, DnsGetHostAddresses_LocalhostAndSubdomain_BothReturnLoopback, and DnsGetHostAddresses_LocalhostSubdomainWithTrailingDot_ReturnsLoopback; assert loopback unconditionally.
  • GetHostEntryTest.cs: same change for the three corresponding DnsGetHostEntry_* tests.
  • Outdated comments referencing the Apple mobile / Android skip are removed.
// before
bool requireLoopback = !PlatformDetection.IsAppleMobile && !PlatformDetection.IsAndroid;
IPAddress[] addresses = Dns.GetHostAddresses(hostName);
Assert.True(addresses.Length >= 1, "Expected at least one address");
if (requireLoopback)
{
    Assert.All(addresses, addr => Assert.True(IPAddress.IsLoopback(addr), $"Expected loopback address but got: {addr}"));
}

// after
IPAddress[] addresses = Dns.GetHostAddresses(hostName);
Assert.True(addresses.Length >= 1, "Expected at least one address");
Assert.All(addresses, addr => Assert.True(IPAddress.IsLoopback(addr), $"Expected loopback address but got: {addr}"));

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 22, 2026 12:26
Copilot AI changed the title [WIP] Fix NameResolution tests on tvos/Android devices Re-enable localhost loopback assertions on Apple mobile and Android May 22, 2026
Copilot AI requested a review from kotlarmilos May 22, 2026 12:27
@jkotas jkotas deleted the copilot/name-resolution-tests-fix branch May 22, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NameResolution tests fail on tvos/Android devices - localhost resolves to non-loopback addresses

2 participants