Skip to content

Clean-up the stack trace when throwing an assertion failure#3152

Merged
dennisdoomen merged 1 commit intofluentassertions:mainfrom
dennisdoomen:cleanup-stack-trace
Feb 9, 2026
Merged

Clean-up the stack trace when throwing an assertion failure#3152
dennisdoomen merged 1 commit intofluentassertions:mainfrom
dennisdoomen:cleanup-stack-trace

Conversation

@dennisdoomen
Copy link
Copy Markdown
Member

@dennisdoomen dennisdoomen commented Jan 23, 2026

This change marks a large portion of the library’s public and internal surface with the runtime’s StackTraceHidden attribute (only when running on .NET 6+), so failures and exceptions show cleaner stack traces that focus on user code instead of framework plumbing.

As a result, assertion failures should be easier to read and debug because internal helper frames are suppressed by the debugger/stack trace renderer.

Alongside that, there are a few formatting-only tweaks (indentation/line breaks) that don’t affect behavior.
The public API baseline for .NET 6 reflects these added attributes so the API “shape” stays in sync.

Note The changes were a mix of AI and manual work, hence there's differences how the attribute was applied

Fixes #512

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 23, 2026

Qodana for .NET

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

@dennisdoomen dennisdoomen force-pushed the cleanup-stack-trace branch 17 times, most recently from b7e6c5e to 92bac35 Compare January 26, 2026 17:01
@dennisdoomen dennisdoomen marked this pull request as ready for review January 26, 2026 17:44
@dennisdoomen dennisdoomen requested a review from jnyrup January 26, 2026 17:44
@dennisdoomen dennisdoomen added this to the 8.9 milestone Jan 28, 2026
@dennisdoomen dennisdoomen force-pushed the cleanup-stack-trace branch 5 times, most recently from 195f025 to a5317ec Compare January 31, 2026 11:31
This was referenced Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confusing CallStack when using Fluent Assertions

3 participants