Repository navigation
Report every TryBeginInvoke failure when a BeginInvokeFailed handler throws [patch] - #88
Open
matt-edmondson wants to merge 2 commits into
Open
matt-edmondson wants to merge 2 commits into
matt-edmondson wants to merge 2 commits into
Conversation
…throws [patch] DoInvokes raised BeginInvokeFailed in a plain loop, so a handler that threw on one failure escaped DoInvokes and discarded the rest. It also read the event twice, so a last handler unsubscribing in between could drop every failure without throwing. Take one handler snapshot, raise each failure in its own try/catch, and throw an AggregateException at the end holding each handler exception followed by the failure it was handling. Fixes #66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4pcgEyqMdpRoLpnBm
…ity in bounds Sonar S3776 counted DoInvokes at cognitive complexity 16 (limit 15) once the per-failure try/catch was added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4pcgEyqMdpRoLpnBm
|
Contributor
Author
|
SonarCloud findings on this PR:
Generated by Claude Code |
This was referenced Nov 1, 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.



Fixes #66
Problem
DoInvokesraisedBeginInvokeFailedin a plainforeach. If a handler threw on one failure, the exception escapedDoInvokesand the remaining failures were discarded. For example, 3 failed actions produced 1 report. It also read the event twice (is null, then?.Invoke), so if the last handler unsubscribed in between, every failure was dropped and nothing was thrown.Change
DoInvokesthrows anAggregateExceptionat the end. It holds each handler exception, followed by the failure that handler was handling.DoInvokesexception docs) and the README event table now describe this.Tests
ThrowingHandlerStillReceivesEveryLaterFailure: 3 failures, and a handler that throws on the first. It asserts that the handler sawfail 0, fail 1, fail 2, that the aggregate holds[handler threw, fail 0], and that a later pump has nothing left to report.mainthe test fails (DoInvokesthrowsInvalidOperationExceptiondirectly, notAggregateException). With the fix it passes.dotnet teston the branch: 41 run, 41 passed, 0 failed.mainCI currently fails at pack (No release since v1.4.4 (Oct 9): every main CI run since Oct 13 fails at pack on package validation (CP0016/CP0001/CP0002…) after the Polyfill 11.4.5 bump #86), which is unrelated to this change.Generated by Claude Code