Fix issue with callback invocation target resolution#14785
Fix issue with callback invocation target resolution#14785davidfowl merged 1 commit intorelease/13.2from
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14785Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14785" |
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22628797900 |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the ATS (Aspire Type System) capability invocation infrastructure where callbacks targeting properties or methods declared on a resource type T would fail when the handle registry contained an IResourceBuilder<T> instead of the resource directly. This happens because AtsCapabilityScanner.MapToAtsTypeId maps both IResourceBuilder<T> and T to the same ATS type ID, so handles of either type can end up being registered under the resource's type ID.
Changes:
- Added
ResolveContextTargetprivate helper inCapabilityDispatcherto unwrap anIResourceBuilder<T>to its.Resourcewhen the member being invoked is declared on the resource typeT - Applied this unwrapping consistently in
RegisterContextTypeProperty(getter and setter) andRegisterContextTypeMethod - Added six new unit tests covering the builder-to-resource resolution scenarios, including regression tests for direct resource handles and inherited properties
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Aspire.Hosting.RemoteHost/Ats/CapabilityDispatcher.cs |
Adds ResolveContextTarget method and applies it to property getter, setter, and instance method dispatch paths |
tests/Aspire.Hosting.RemoteHost.Tests/CapabilityDispatcherTests.cs |
Adds test helper classes (TestResourceBuilder<T>, TestResourceWithProperties, TestResourceWithMethods) and six new [Fact] tests covering the fix |
|
@IEvangelist wrong base branch |
…operties and methods
ed55c1a to
dd4e267
Compare
@davidfowl - fixed, targeting correct branch now. |
…operties and methods (#14785)
Description
Enhance capability invocation by resolving builder to resource for properties and methods
Contributes to #14772
Fixes this issue:
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: