address #1351 - waitfor between script and runspace not respected#1352
address #1351 - waitfor between script and runspace not respected#1352oising wants to merge 5 commits into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1352Or
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1352" |
There was a problem hiding this comment.
Pull request overview
Fixes the PowerShell hosting integration’s WaitFor(...) behavior regression (reported in #1351) by aligning resource lifecycle/eventing with Aspire 13.2+ expectations (publishing a Starting state before BeforeResourceStartedEvent so dependencies can block correctly).
Changes:
- Publish
KnownResourceStates.Startingfor runspace pool and script resources during initialization to ensureWaitFor(...)is respected. - Avoid duplicate/initial-state notifications by skipping
NotStarted(and for the pool,Starting) state publications from subsequent runtime state-change handlers. - Update the examples PowerShell AppHost with an
aspire.config.jsonentry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/CommunityToolkit.Aspire.Hosting.PowerShell/PowerShellScriptResource.cs | Skips publishing state updates for the initial NotStarted state; disposes _cts without nullable check. |
| src/CommunityToolkit.Aspire.Hosting.PowerShell/PowerShellRunspacePoolResourceBuilderExtensions.cs | Publishes Starting before BeforeResourceStartedEvent for scripts; adjusts how script startup is invoked. |
| src/CommunityToolkit.Aspire.Hosting.PowerShell/PowerShellRunspacePoolResource.cs | Skips publishing NotStarted/Starting updates from pool state-change events (relies on initializer for Starting). |
| src/CommunityToolkit.Aspire.Hosting.PowerShell/DistributedApplicationBuilderExtensions.cs | Publishes Starting before BeforeResourceStartedEvent for the runspace pool; awaits pool start. |
| examples/powershell/CommunityToolkit.Aspire.PowerShell.AppHost/aspire.config.json | Adds Aspire app host config pointing to the AppHost project. |
…om/oising/CommunityToolkitAspire into powershell-runspace-opening-race-1
aaronpowell
left a comment
There was a problem hiding this comment.
Only a minor nit then it'd be fine to merge.
There was a problem hiding this comment.
let's drop this file, as it can cause a pain with the wider tooling (we need to figure out a better way to handle this though)
**Closes #1351 **
PR Checklist
Other information