Skip to content

Relax localhost subdomain address-family checks on Android/AppleMobile#128404

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/ci-scan-test-failure-fix
Open

Relax localhost subdomain address-family checks on Android/AppleMobile#128404
Copilot wants to merge 2 commits into
mainfrom
copilot/ci-scan-test-failure-fix

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 20, 2026

main PR

Description

This PR relaxes AddressFamily assertions for *.localhost DNS functional tests on Android and Apple mobile, where OS resolvers can return mixed-family results (for example, link-local IPv6 entries during IPv4 queries), causing flakes.

It now applies the same platform-specific behavior to both:

  • DnsGetHostEntry_LocalhostSubdomain_RespectsAddressFamily
  • DnsGetHostAddresses_LocalhostSubdomain_RespectsAddressFamily

On Android/Apple mobile, tests require the requested family to be represented where applicable and skip strict per-entry family enforcement. On other platforms, strict family validation is preserved.

Customer Impact

Reduces CI/test flakiness on mobile platforms and improves reliability of runtime-extra-platforms validation without changing product behavior.

Regression

No product regression fix; this is a test expectation adjustment for platform-specific resolver behavior.

Testing

  • Ran targeted functional tests for:
    • DnsGetHostEntry_LocalhostSubdomain_RespectsAddressFamily
    • DnsGetHostAddresses_LocalhostSubdomain_RespectsAddressFamily
  • Verified targeted test run passed.

Risk

Low risk. Changes are limited to test code in System.Net.NameResolution functional tests and only relax assertions on Android/Apple mobile while keeping strict validation elsewhere.

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.

…roid/AppleMobile

Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 20, 2026 13:33
Copilot AI changed the title [WIP] Fix test failure for DnsGetHostEntry_LocalhostSubdomain_RespectsAddressFamily Relax address-family check in DnsGetHostEntry_LocalhostSubdomain_RespectsAddressFamily on Android/AppleMobile May 20, 2026
Copilot AI requested a review from kotlarmilos May 20, 2026 13:34
@kotlarmilos
Copy link
Copy Markdown
Member

/azp run runtime-extra-platforms

@kotlarmilos kotlarmilos requested a review from rzikm May 22, 2026 13:16
@kotlarmilos kotlarmilos added this to the 11.0.0 milestone May 22, 2026
@kotlarmilos kotlarmilos marked this pull request as ready for review May 22, 2026 13:16
Copilot AI review requested due to automatic review settings May 22, 2026 13:16
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts System.Net.NameResolution functional test expectations for Dns.GetHostEntry(..., AddressFamily) on Android/Apple mobile where the OS resolver can return mixed-family results, reducing platform-specific flakiness while keeping stricter validation on other platforms.

Changes:

  • Adds platform gating (strictAddressFamily) to relax address-family assertions on Android/Apple mobile.
  • Factors shared sync/async validation into a local VerifyAddressFamily helper.
  • Replaces per-element Assert.All (always) with “requested family must be present” (Assert.Contains) plus conditional strict validation.
Show a summary per file
File Description
src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs Relaxes address-family assertions on Android/Apple mobile and refactors the sync/async checks into a helper.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment on lines +452 to +456
Assert.Contains(entry.AddressList, addr => addr.AddressFamily == addressFamily);
if (strictAddressFamily)
{
Assert.All(entry.AddressList, addr => Assert.Equal(addressFamily, addr.AddressFamily));
}
Copy link
Copy Markdown
Member

@rzikm rzikm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, modulo existing comment

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

@rzikm
Copy link
Copy Markdown
Member

rzikm commented May 27, 2026

/azp run runtime-extra-platforms

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rzikm
Copy link
Copy Markdown
Member

rzikm commented May 27, 2026

@copilot There is a similar failure for DnsGetHostAddresses_LocalhostSubdomain_RespectsAddressFamily, can you address this one as well?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 27, 2026

@copilot There is a similar failure for DnsGetHostAddresses_LocalhostSubdomain_RespectsAddressFamily, can you address this one as well?

Addressed in 27909d9. I applied the same Android/AppleMobile relaxation to DnsGetHostAddresses_LocalhostSubdomain_RespectsAddressFamily by gating strict Assert.All checks behind the same platform condition and keeping IPv4 presence validation via Assert.Contains.

Copilot AI changed the title Relax address-family check in DnsGetHostEntry_LocalhostSubdomain_RespectsAddressFamily on Android/AppleMobile Relax localhost subdomain address-family checks on Android/AppleMobile May 27, 2026
Copilot finished work on behalf of rzikm May 27, 2026 12:19
Copilot AI requested a review from rzikm May 27, 2026 12:19
@rzikm
Copy link
Copy Markdown
Member

rzikm commented May 27, 2026

/azp run runtime-extra-platforms

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

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.

[ci-scan] Test failure: System.Net.NameResolution.Tests.GetHostEntryTest.DnsGetHostEntry_LocalhostSubdomain_RespectsAddressFamily

5 participants