Skip to content

Keep the action's stack trace when RethrowExceptions rethrows [patch] - #62

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/intervalaction-58-rethrow-stack-trace
Sep 28, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
claude/intervalaction-58-rethrow-stack-trace

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #58

What changed

TryRun() and RethrowExceptions() rethrew the action's exception with throw ex. That overwrote the exception's StackTrace, so the trace began at RethrowExceptions and left out the frames of the action that failed. Both sites now use ExceptionDispatchInfo.Capture(ex).Throw(), the fix ktsu-dev/Invoker#54 used for the same problem. The exception type and message do not change.

Test

Added RethrowExceptionsKeepsTheActionStackTrace. The action throws from a named method, and the test asserts that the trace of the exception caught from RethrowExceptions() contains that method's name.

  • Without the fix, the test fails: the trace starts at IntervalAction.RethrowExceptions().
  • With the fix, all 19 tests pass on net10.0, and I ran the suite three times to check the timing-based tests are stable. The library builds for every target.

🤖 Generated with Claude Code

https://claude.ai/code/session_013xQ2dceFuWS8VLEn2xLuZE


Generated by Claude Code

TryRun and RethrowExceptions rethrew the action's exception with
`throw ex`, which reset its StackTrace so it began at RethrowExceptions.
Rethrow through ExceptionDispatchInfo instead, as Invoker does since
ktsu-dev/Invoker#54.

Fixes #58

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013xQ2dceFuWS8VLEn2xLuZE
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants