Open
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements RFC 6761 compliant handling of reserved DNS names by extending special-case treatment beyond just "localhost" to include its subdomains (e.g., "service.localhost") and the "invalid" domain. The implementation centralizes reserved name checking and ensures DNS servers are not contacted for these special cases.
Key Changes:
- Refactored localhost resolution logic into a shared
CheckIsReservedDnsNamemethod that handles both "localhost" and "invalid" domains plus their subdomains - Added comprehensive test coverage for reserved name resolution including subdomain variants and explicit root labels
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Libraries/Microsoft.Extensions.ServiceDiscovery.Dns/Resolver/DnsResolver.cs | Refactored hardcoded localhost checks into centralized RFC 6761 reserved name handling with support for subdomains and the "invalid" domain |
| test/Libraries/Microsoft.Extensions.ServiceDiscovery.Dns.Tests/Resolver/ResolveAddressesTests.cs | Added test cases for subdomain variants of reserved names and renamed test to reflect broader scope |
16 tasks
rzikm
commented
Oct 15, 2025
.../Libraries/Microsoft.Extensions.ServiceDiscovery.Dns.Tests/Resolver/ResolveAddressesTests.cs
Show resolved
Hide resolved
…/Resolver/ResolveAddressesTests.cs
Member
Author
|
@ReubenBond gentle ping here, can we get this reviewed? |
Member
|
@ReubenBond looks like this is waiting on you? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces dotnet/aspire#10311 since the code moved to this repo.
The Managed DNS implementation correctly special-cased "localhost" and resolved to loopback without contacting DNS server, but the authoritative RFC 6761 requires the same for subdomains as well (e.g. service.localhost). Ths PR fills the gap, including the other special-cased name "invalid".