Skip to content

[mobile] Skip DnsGetHostEntry_LocalHost test on Android#127420

Merged
kotlarmilos merged 3 commits intomainfrom
mobile-fix-nameresolution-android-03bfe8de85cad164
Apr 28, 2026
Merged

[mobile] Skip DnsGetHostEntry_LocalHost test on Android#127420
kotlarmilos merged 3 commits intomainfrom
mobile-fix-nameresolution-android-03bfe8de85cad164

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Note

This content was generated by GitHub Copilot.

Summary

Fixes System.Net.NameResolution.Functional.Tests.GetHostEntryTest.DnsGetHostEntry_LocalHost_ReturnsFqdnAndLoopbackIPs test failure on Android by skipping the test on that platform.

Background

The test assumes that resolving "localhost" returns only loopback IP addresses (127.0.0.1 and ::1). However, on Android Helix machines (emulators), the DNS resolution for "localhost" returns actual network interfaces in addition to loopback addresses, causing the test to fail with assertions like:

Assert.All() Failure: 5 out of 6 items in the collection did not pass.
[1]: Item:  fe80::e05a:f2ff:fee9:6ae6%47
     Error: Not a loopback address: fe80::e05a:f2ff:fee9:6ae6%47
[2]: Item:  2001:4898:502:2:e05a:f2ff:fee9:6ae6
     Error: Not a loopback address: 2001:4898:502:2:e05a:f2ff:fee9:6ae6
[5]: Item:  10.64.32.211
     Error: Not a loopback address: 10.64.32.211
````

## Changes

Added `[SkipOnPlatform(TestPlatforms.Android, ...)]` attribute to the failing test, consistent with existing skips for iOS, tvOS, and MacCatalyst on the same test (which have similar issues).

## Failure Details

**Build:** https://dev.azure.com/dnceng-public/public/_build/results?buildId=1396313

**Job:** `android-arm64 Release AllSubsets_Mono`

**Helix Work Item:** System.Net.NameResolution.Functional.Tests
- Job ID: `93091357-214b-436d-a5c4-a31ee456a876`
- Console log: https://helix.dot.net/api/2019-06-17/jobs/93091357-214b-436d-a5c4-a31ee456a876/workitems/System.Net.NameResolution.Functional.Tests/console

**Log excerpt (sanitized):**
````
04-25 00:03:35.029  DOTNET  : [FAIL] System.Net.NameResolution.Tests.GetHostEntryTest.DnsGetHostEntry_LocalHost_ReturnsFqdnAndLoopbackIPs(mode: 0)
04-25 00:03:35.029  DOTNET  : Assert.All() Failure: 5 out of 6 items in the collection did not pass.
04-25 00:03:35.029  DOTNET  : [5]: Item:  10.64.32.211
04-25 00:03:35.029  DOTNET  :      Error: Not a loopback address: 10.64.32.211

Related

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

  • #126805 search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Mobile Platform Failure Scanner · ● 4.1M ·

Android Helix machines have network interfaces with non-loopback addresses
that are returned when querying localhost, causing this test to fail.
The test assumes localhost resolves only to loopback addresses (127.0.0.1
and ::1), but Android emulators return actual network interfaces.

This is consistent with existing skips on iOS, tvOS, and MacCatalyst for
similar reasons.

Fixes android-arm64 Release AllSubsets_Mono failure in build 1396313:
https://dev.azure.com/dnceng-public/public/_build/results?buildId=1396313

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@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.

@github-actions
Copy link
Copy Markdown
Contributor Author

🤖 Copilot Code Review — PR #127420

Note

This review was generated by Copilot.

Holistic Assessment

Motivation: The test DnsGetHostEntry_LocalHost_ReturnsFqdnAndLoopbackIPs asserts that localhost DNS resolution returns only loopback addresses, but Android Helix machines return non-loopback addresses. Skipping this test on Android is a reasonable response to a platform behavior difference that causes CI failures.

Approach: The change adds a single [SkipOnPlatform] attribute. The skip reason is descriptive and the attribute is correctly placed alongside the existing platform-specific attributes.

Summary: ⚠️ Needs Human Review. The code change itself is correct, but two points warrant human judgment: (1) the choice of [SkipOnPlatform] vs [ActiveIssue], and (2) whether sibling tests asserting IsLoopback for localhost resolution also need the same skip on Android.


Detailed Findings

⚠️ Convention — [SkipOnPlatform] vs [ActiveIssue] for this failure

The existing convention in this file for Android-specific test failures is [ActiveIssue] with a tracking GitHub issue:

  • Line 418: [ActiveIssue("https://github.com/dotnet/runtime/issues/124751", TestPlatforms.Android)]
  • Line 453: [ActiveIssue("https://github.com/dotnet/runtime/issues/126456", ... | TestPlatforms.Android)]

The same test already uses [ActiveIssue] for iOS/tvOS/MacCatalyst (line 263) for what appears to be the same category of platform-specific localhost resolution behavior.

[SkipOnPlatform] is used in this file for permanent platform limitations (e.g., "WASI has no getnameinfo") — cases where the platform fundamentally cannot support the tested functionality. An [ActiveIssue] with a tracking issue would be more consistent here unless this is considered a permanent, unfixable Android behavior rather than a Helix environment issue or a resolvable platform quirk. Without a tracking issue, this failure becomes invisible to future triage.

Suggestion: Consider using [ActiveIssue("https://github.com/dotnet/runtime/issues/<new_issue>", TestPlatforms.Android)] with a filed tracking issue, consistent with how similar platform-specific failures are tracked in this file. If [SkipOnPlatform] is intentional (i.e., Android is expected to return non-loopback for localhost and this will never change), then a brief comment in the PR description explaining that rationale would be helpful.

⚠️ Cross-cutting — Sibling tests that also assert IsLoopback for localhost

Several other tests in this file and in GetHostAddressesTest.cs assert that localhost-related resolution returns only loopback addresses:

  • DnsGetHostEntry_LocalhostSubdomain_ReturnsLoopback (line 357) — resolves foo.localhost etc., falls back to localhost
  • DnsGetHostEntry_LocalhostWithTrailingDot_ReturnsLoopback (line 402) — resolves localhost.
  • DnsGetHostAddresses_LocalhostSubdomain_ReturnsLoopback (line 234 in GetHostAddressesTest.cs) — same pattern

If Android DNS resolution returns non-loopback addresses for plain localhost, these related tests may also be affected (especially the trailing-dot variant, which is equivalent to plain localhost). If they are already passing on Android, no action is needed — but it's worth verifying.

✅ Attribute placement and skip message are correct

The [SkipOnPlatform] is placed correctly in the attribute list and the skip message clearly explains the reason for skipping.

Generated by Code Review for issue #127420 ·

@kotlarmilos
Copy link
Copy Markdown
Member

@copilot extend [ActiveIssue("https://github.com/dotnet/runtime/issues/124079", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] instead of SkipOnPlatform.

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

@copilot extend [ActiveIssue("https://github.com/dotnet/runtime/issues/124079", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] instead of SkipOnPlatform.

Done in 88e4d2f. Replaced [SkipOnPlatform(TestPlatforms.Android, ...)] with extending the existing [ActiveIssue] attribute to include TestPlatforms.Android.

Copilot AI requested a review from kotlarmilos April 27, 2026 09:00
@kotlarmilos kotlarmilos marked this pull request as ready for review April 27, 2026 11:26
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

Updates System.Net.NameResolution functional tests to avoid Android-specific failures in DnsGetHostEntry_LocalHost_ReturnsFqdnAndLoopbackIPs by extending an existing platform-conditional suppression to include Android.

Changes:

  • Extend the existing [ActiveIssue(...)] platform mask for DnsGetHostEntry_LocalHost_ReturnsFqdnAndLoopbackIPs to include TestPlatforms.Android.
Show a summary per file
File Description
src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs Adds Android to the platform list for an ActiveIssue-based skip on a localhost/loopback assertion test.

Copilot's findings

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

@kotlarmilos kotlarmilos merged commit fd00557 into main Apr 28, 2026
95 checks passed
@kotlarmilos kotlarmilos deleted the mobile-fix-nameresolution-android-03bfe8de85cad164 branch April 28, 2026 09:05
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.

3 participants