Sitelet https://github.com/fluentassertions/fluentassertions/pull/3290
Skip to content

Clean-up the stack trace further - #3290

Merged
jnyrup merged 2 commits into
mainfrom
StackTraceHidden
Aug 7, 2026
Merged

jnyrup merged 2 commits into
mainfrom
StackTraceHidden

Conversation

@jnyrup

@jnyrup jnyrup commented Aug 6, 2026

Copy link
Copy Markdown
Member

Hide methods that are not { public, protected, protected internal }.

Follow-up to #3152

As an example, here are the before and after stack traces of When_an_ulong_value_is_not_close_to_expected_value_it_should_fail if we let it fail.

before:

NumericAssertionsExtensions.FailIfValueOutsideBounds[TValue,TDelta](AssertionChain assertionChain, Boolean valueWithinBounds, TValue nearbyValue, TDelta delta, TValue actualValue, String because, Object[] becauseArgs) line 363
NumericAssertionsExtensions.BeCloseTo(NumericAssertions`1 parent, UInt64 nearbyValue, UInt64 delta, String because, Object[] becauseArgs) line 350
BeCloseTo.When_an_ulong_value_is_not_close_to_expected_value_it_should_fail(UInt64 actual, UInt64 nearbyValue, UInt64 delta) line 707
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)

after:

NumericAssertionsExtensions.BeCloseTo(NumericAssertions`1 parent, UInt64 nearbyValue, UInt64 delta, String because, Object[] becauseArgs) line 350
BeCloseTo.When_an_ulong_value_is_not_close_to_expected_value_it_should_fail(UInt64 actual, UInt64 nearbyValue, UInt64 delta) line 707
InvokeStub_BeCloseTo.When_an_ulong_value_is_not_close_to_expected_value_it_should_fail(Object, Span`1)
MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

Ignore the first commit, that's #3257

IMPORTANT

  • If the PR touches the public API, the changes have been approved in a separate issue with the "api-approved" label.
  • The code complies with the Coding Guidelines for C#.
  • The changes are covered by unit tests which follow the Arrange-Act-Assert syntax and the naming conventions such as is used in these tests.
  • If the PR adds a feature or fixes a bug, please update the release notes with a functional description that explains what the change means to consumers of this library, which are published on the website.
  • If the PR changes the public API the changes needs to be included by running AcceptApiChanges.ps1 or AcceptApiChanges.sh.
  • If the PR affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
    • Please also run ./build.sh --target spellcheck or .\build.ps1 --target spellcheck before pushing and check the good outcome

CONTRIBUTOR LICENSE GRANT

By submitting this contribution, the contributor hereby irrevocably grants to the project owners and maintainers a perpetual, worldwide, royalty-free, irrevocable license to use, reproduce, modify, distribute, sublicense, and create derivative works of the contribution for any purpose and under any terms, including proprietary licensing.

The contributor waives any moral rights in the contribution to the extent permitted by law and agrees not to assert any claim of authorship or control over the contribution. The contributor represents that they are the sole author of the contribution and that it is provided free of any third-party claims.

The contributor understands and agrees that the maintainers may, at their sole discretion, use, license, or redistribute the contribution as part of any work and under any terms they choose, without further permission or attribution.

  • I have read the Contributor License Grant and accept the conditions
  • I'm interested in a free license for Fluent Assertions and will share my email address through sales@xceed.com

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Test Results

    37 files  ± 0      37 suites  ±0   2m 30s ⏱️ -14s
 6 392 tests + 2   6 391 ✅ + 2  1 💤 ±0  0 ❌ ±0 
39 698 runs  +12  39 692 ✅ +12  6 💤 ±0  0 ❌ ±0 

Results for commit 0b8c84c. ± Comparison against base commit eb1d602.

This pull request removes 10 and adds 10 tests. Note that renamed tests count towards both.
FluentAssertions.Specs.Streams.StreamAssertionSpecs+HaveLength ‑ When_a_throwing_stream_should_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
FluentAssertions.Specs.Streams.StreamAssertionSpecs+HaveLength ‑ When_a_throwing_stream_should_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
FluentAssertions.Specs.Streams.StreamAssertionSpecs+HavePosition ‑ When_a_throwing_stream_should_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
FluentAssertions.Specs.Streams.StreamAssertionSpecs+HavePosition ‑ When_a_throwing_stream_should_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHaveLength ‑ When_a_throwing_stream_should_not_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHaveLength ‑ When_a_throwing_stream_should_not_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHavePosition ‑ When_a_throwing_stream_should_not_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHavePosition ‑ When_a_throwing_stream_should_not_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GetLengthExceptionMessage'.)
Object name: 'GetPositionExceptionMessage'.)
FluentAssertions.Specs.StackTraceHiddenSpecs ‑ Non_public_methods_in_annotable_classes_are_hidden
FluentAssertions.Specs.StackTraceHiddenSpecs ‑ Public_methods_in_annotable_classes_are_not_hidden
FluentAssertions.Specs.Streams.StreamAssertionSpecs+HaveLength ‑ When_a_throwing_stream_should_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GetLengthExceptionMessage'.)
FluentAssertions.Specs.Streams.StreamAssertionSpecs+HaveLength ‑ When_a_throwing_stream_should_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GetLengthExceptionMessage'.)
FluentAssertions.Specs.Streams.StreamAssertionSpecs+HavePosition ‑ When_a_throwing_stream_should_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GetPositionExceptionMessage'.)
FluentAssertions.Specs.Streams.StreamAssertionSpecs+HavePosition ‑ When_a_throwing_stream_should_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GetPositionExceptionMessage'.)
FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHaveLength ‑ When_a_throwing_stream_should_not_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GetLengthExceptionMessage'.)
FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHaveLength ‑ When_a_throwing_stream_should_not_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GetLengthExceptionMessage'.)
FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHavePosition ‑ When_a_throwing_stream_should_not_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GetPositionExceptionMessage'.)
FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHavePosition ‑ When_a_throwing_stream_should_not_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GetPositionExceptionMessage'.)

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

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 qodana-support@jetbrains.com

@dennisdoomen dennisdoomen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a shame that there isn't a better solution for this

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 31158301585

Coverage remained the same at 97.15%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 2 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

2 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
Src/FluentAssertions/Formatting/LineCollection.cs 1 98.04%
Src/FluentAssertions/Numeric/NumericAssertionsBase.cs 1 96.43%

Coverage Stats

Coverage Status
Relevant Lines: 13405
Covered Lines: 13180
Line Coverage: 98.32%
Relevant Branches: 4384
Covered Branches: 4102
Branch Coverage: 93.57%
Branches in Coverage %: Yes
Coverage Strength: 67341.73 hits per line

💛 - Coveralls

@jnyrup
jnyrup merged commit 57f9f92 into main Aug 7, 2026
14 checks passed
@jnyrup
jnyrup deleted the StackTraceHidden branch August 7, 2026 10:49
This was referenced Sep 14, 2026
This was referenced Oct 2, 2026

This branch was previously deployed

1 inactive deployment
qodana-pr — 0b8c84c4 Deployed Aug 7, 2026 by jnyrup via Qodana Scan #46
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.

3 participants