fix: handle disposed scope during workflow instance refresh after Blazor disconnect#770
Draft
fix: handle disposed scope during workflow instance refresh after Blazor disconnect#770
Conversation
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix occasional crashes in Elsa Studio 3.5.2
fix: handle disposed scope during workflow instance refresh after Blazor disconnect
Mar 3, 2026
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.
Purpose
Prevents intermittent host crashes in Workflow Instance Viewer when a Blazor Server circuit disconnects and a timer callback continues into disposed scoped services (
IServiceProvider).This targets the
ObjectDisposedExceptionpath reported from activity execution refresh calls.Scope
Select one primary concern:
Description
Problem
A periodic refresh in
WorkflowInstanceDesignercan outlive circuit lifetime. After_blazor/disconnect, refresh callbacks may still execute and attempt to resolve/use scoped services via backend API providers, triggering unhandledObjectDisposedExceptionand process termination.Solution
RefreshSelectedItemAsyncbody intry/catch (ObjectDisposedException).StopRefreshActivityStatePeriodically()to prevent repeated callbacks into disposed scope.Example change:
Verification
Steps:
/_blazor/disconnect) while refresh callbacks are in flight.Expected outcome:
ObjectDisposedExceptionfrom disposedIServiceProvider.Screenshots / Recordings (if applicable)
Not applicable (no UI layout/visual changes).
Commit Convention
We recommend using conventional commit prefixes:
fix:– Bug fixes (behavior change)feat:– New featuresrefactor:– Code changes without behavior changedocs:– Documentation updateschore:– Maintenance, tooling, or dependency updatestest:– Test additions or modificationsClear commit messages make reviews easier and history more meaningful.
Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.