Visitar URL original
Fix NotSupportedException from ReduceConstantSubExpressions by cbersch · Pull Request #538 · AwesomeAssertions/AwesomeAssertions · GitHub
Skip to content

Fix NotSupportedException from ReduceConstantSubExpressions - #538

Merged
cbersch merged 1 commit into
AwesomeAssertions:mainfrom
cbersch:cbersch/fix-predicatelambdaexpressionvalueformatter
Jul 14, 2026
Merged

cbersch merged 1 commit into
AwesomeAssertions:mainfrom
cbersch:cbersch/fix-predicatelambdaexpressionvalueformatter

Conversation

@cbersch

@cbersch cbersch commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

C# 14 "first-class spans" causes MemoryExtensions.Contains to be picked over Enumerable.Contains.
ConstantSubExpressionReductionVisitor.Visit calls DynamicInvoke which then throws a NotSupportedException from RuntimeMethodInfo.ThrowNoInvokeException

Backport of fluentassertions/fluentassertions@6ad1fb8

Part of #534

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

Legal checklist

  • This work is entirely original, it is not derived from any existing code incompatible with the Apache 2.0 License, like FluentAssertions.

C# 14' "first-class spans" causes `MemoryExtensions.Contains` to be picked over `Enumerable.Contains`.
`ConstantSubExpressionReductionVisitor.Visit` calls `DynamicInvoke` which then throws a `NotSupportedException` from [`RuntimeMethodInfo.ThrowNoInvokeException`](https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs,70)

For more information see dotnet/runtime#120251
@cbersch
cbersch force-pushed the cbersch/fix-predicatelambdaexpressionvalueformatter branch from 054c7c0 to 0710e72 Compare July 13, 2026 05:55
@sonarqubecloud

Copy link
Copy Markdown

@coveralls

coveralls commented Jul 13, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 29227531155

Coverage increased (+0.02%) to 96.725%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 12911
Covered Lines: 12758
Line Coverage: 98.81%
Relevant Branches: 4034
Covered Branches: 3632
Branch Coverage: 90.03%
Branches in Coverage %: Yes
Coverage Strength: 57209.15 hits per line

💛 - Coveralls

@cbersch
cbersch marked this pull request as ready for review July 13, 2026 06:09
@cbersch
cbersch requested a review from a team July 13, 2026 06:09
@cbersch cbersch added the bug Something isn't working label Jul 13, 2026

@IT-VBFK IT-VBFK 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.

Thanks

@cbersch
cbersch merged commit 1a87cd3 into AwesomeAssertions:main Jul 14, 2026
8 checks passed
This was referenced Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants