Skip to content

Await the deployed instances refresh instead of firing it as async void - #5768

Merged
johnsimons merged 1 commit into
masterfrom
john/listinstances_async_void
Aug 13, 2026
Merged

johnsimons merged 1 commit into
masterfrom
john/listinstances_async_void

Conversation

@johnsimons

Copy link
Copy Markdown
Member

ListInstancesViewModel.AddAndRemoveInstances was a genuine async void, not an event handler. It returned at its first await, so HandleAsync(RefreshInstances) published PostRefreshInstances while the removals were still in flight. That is the exact ordering the method's own remarks say must not happen: deleting an instance in PowerShell could then error out a deleted instance viewmodel trying to refresh itself.

It is now async Task and awaited. The only thing that kept it async void was the constructor call site, which cannot await; that call moves to RxScreen.OnInitialize, which takes a token and is awaited by IActivate.ActivateAsync.

The list therefore populates on activation rather than construction. The CorruptInstanceConfiguration specs construct the viewmodel directly, so they now activate it before asserting.

Deferred since Phase 0 of the cancellation work, and unblocked by OnInitialize gaining a CancellationToken.

ListInstancesViewModel.AddAndRemoveInstances was a genuine async void, not
an event handler. It returned at its first await, so
HandleAsync(RefreshInstances) published PostRefreshInstances while the
removals were still in flight. That is the exact ordering the method's own
remarks say must not happen: deleting an instance in PowerShell could then
error out a deleted instance viewmodel trying to refresh itself.

It is now async Task and awaited. The only thing that kept it async void
was the constructor call site, which cannot await; that call moves to
RxScreen.OnInitialize, which takes a token and is awaited by
IActivate.ActivateAsync.

The list therefore populates on activation rather than construction. The
CorruptInstanceConfiguration specs construct the viewmodel directly, so
they now activate it before asserting.

Deferred since Phase 0 of the cancellation work, and unblocked by
OnInitialize gaining a CancellationToken.
@johnsimons
johnsimons requested a review from rbev August 13, 2026 06:58
@johnsimons johnsimons self-assigned this Aug 13, 2026
@johnsimons
johnsimons enabled auto-merge August 13, 2026 08:26
@johnsimons
johnsimons merged commit 0e55aec into master Aug 13, 2026
105 of 106 checks passed
@johnsimons
johnsimons deleted the john/listinstances_async_void branch August 13, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants