Revert peer matching logic to fix database resource resolution regression#10456
Merged
Revert peer matching logic to fix database resource resolution regression#10456
Conversation
…iling tests Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Regression when matching to database as uninstrumented peer
Revert peer matching logic to fix database resource resolution regression
Jul 16, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR reverts peer matching logic to fix a regression where database calls to uninstrumented peers no longer matched their corresponding database resources in the Aspire Dashboard. The issue was introduced in PR #10411 which changed the logic from "first one wins" to "return false if multiple resources match the same address."
Key changes:
- Restored immediate return on first match in
TryMatchAgainstResourcesmethod - Removed 5 test methods that validated the problematic "multiple matches return false" behavior
- Updated existing tests to expect the restored "first one wins" behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Aspire.Dashboard/Model/ResourceOutgoingPeerResolver.cs |
Reverted the TryMatchAgainstResources method to return immediately on first match instead of checking for multiple matches |
tests/Aspire.Dashboard.Tests/ResourceOutgoingPeerResolverTests.cs |
Removed 5 problematic test methods and updated existing tests to validate the restored "first one wins" logic |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
JamesNK
approved these changes
Jul 16, 2025
Member
|
/backport release/9.4 |
Member
|
/backport to release/9.4 |
Contributor
|
Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16333078441 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
A regression was introduced in PR #10411 where database calls to uninstrumented peers no longer match their corresponding database resources in the Aspire Dashboard. This caused database connections to appear unmatched (with red error icons) instead of being properly linked to their database resources.
The issue occurred because the peer matching logic was changed from "first one wins" to "return false if multiple resources match the same address." While this was intended to handle ambiguous cases, it caused legitimate database connections to fail matching when multiple resources shared similar addresses.
Examples
Before (working):

After PR #10411 (broken):

The red database icon shows the call to
localhost:52074no longer matches the postgres database resource.Solution
This PR reverts the
TryMatchAgainstResourcesmethod back to the original "first one wins" logic as requested by @davidfowl for the 9.4 release:trueimmediately when a matching resource is found, instead of checking for multiple matchesCode Changes
Impact
localhost:52074) now correctly match database resourcesThis follows @davidfowl's guidance to revert PR #10411 changes for 9.4, allowing the team to design a more sophisticated approach for handling ambiguous matches in future releases.
Fixes #10452.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.