Repository navigation
Avoid sending JSInterop calls when component is disposed - #69517
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Only minor test-coverage nits remain, with no approval-blocking issues.
Review effort: Lite
Findings: None
What changed in this PR
Prevents Virtualize<TItem> from issuing JS interop calls after disposal begins, including disposal races.
Changes:
- Adds disposal guards and race-safe exception handling.
- Adds regression tests for pending interop operations.
| File | Changes |
|---|---|
src/Components/Web/test/Virtualization/VirtualizeTest.cs |
Adds disposal-race regression tests. |
src/Components/Web/src/Virtualization/VirtualizeJsInterop.cs |
Centralizes disposal state and guarded JS calls. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
javiercn
approved these changes
Sep 25, 2026
ilonatommy
enabled auto-merge (squash)
September 25, 2026 13:47
Member
Author
|
/ba-g Failures look like #62308. No Virtualize failures among the failed tests. |
ilonatommy
disabled auto-merge
September 25, 2026 15:18
Member
Author
|
/backport to release/11.0 |
Contributor
|
Started backporting to |
4 of 10 tasks
This was referenced Sep 26, 2026
wtgodbe
pushed a commit
that referenced
this pull request
Oct 7, 2026
…9522) * Regression test for the report. * Guard all outcomming JSInterop calls with disposal check. Co-authored-by: Ilona Tomkowicz <[email protected]>
4 of 14 tasks
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.
Virtualize<TItem>can be disposed while an asynchronous JS interop operation is pending. When the operation completes, the lifecycle continuation may issue another interop call using the component's disposedDotNetObjectReference, resulting in anObjectDisposedExceptionand circuit termination.This change centralizes disposal handling in
VirtualizeJsInterop, which owns the object reference. It consists of:ObjectDisposedExceptionwhen disposal races with an invocation already starting.Fixes #69501
The reported issue was reproduced on Aspire dashboard on the ~400th navigation attempt before the fix and was proven to be gone after this fix - checked with 1k navigations.