Skip to content

Conversation

@JSkimming
Copy link
Contributor

@JSkimming JSkimming commented Sep 26, 2025

The first commit demonstrates the issue; the second commit proposes a solution.

The third commit makes the JsonNodeAssertions generic, which propagates the type safety of the Subject.

Fixes #3103

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
Copy link

github-actions bot commented Sep 26, 2025

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

@JSkimming JSkimming changed the title Demonstrate compile error when asserting against JsonObject Fix compilation error CS0121: The call is ambiguous ... Sep 26, 2025
@dennisdoomen
Copy link
Member

Thanks for the fix. I somehow completely missed this scenaroi.

@jnyrup technically this is a breaking change, but given we only released 8.7 yesterday, I'm fine shipping this as 8.7.1. What do you think?

@dennisdoomen dennisdoomen changed the title Fix compilation error CS0121: The call is ambiguous ... Fixed an ambiguity when using BeNull on a JsonNode Sep 27, 2025
@JSkimming JSkimming force-pushed the add-support-for-json-object branch from 8d8a616 to 34252ba Compare September 27, 2025 20:24
@JSkimming JSkimming changed the title Fixed an ambiguity when using BeNull on a JsonNode Fixed ambiguity when using Should on a JsonNode derived class Sep 27, 2025
@JSkimming
Copy link
Contributor Author

Hi All.

I've incorporated your feedback. Please let me know what you think.

I've also updated the documentation and the release notes and checked the spelling. I hope that all looks OK.

Finally, I've changed the name of the PR, as the compile error wasn't limited to the BeNull() method, but any use of Should() on a JsonNode derived class.

I'm now off to watch a movie. Perhaps some classic horror 🤔, maybe something from John Carpenter.

@jnyrup
Copy link
Member

jnyrup commented Sep 27, 2025

Thanks for the contribution and enjoy the movie.
I've been rewatching Twin Peaks tonight.

@dennisdoomen dennisdoomen enabled auto-merge (squash) September 28, 2025 06:56
@dennisdoomen
Copy link
Member

Thanks for this fix @JSkimming

I've been watching Tron Legacy with my son last night. It's from 2010 and he's from 2012 ;-)

@dennisdoomen dennisdoomen added this to the 8.7.1 milestone Sep 28, 2025
@dennisdoomen dennisdoomen merged commit cf9a506 into fluentassertions:main Sep 28, 2025
8 checks passed
@coveralls
Copy link

Pull Request Test Coverage Report for Build 18064626329

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 18 of 18 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.16%

Totals Coverage Status
Change from base Build 18056550367: 0.0%
Covered Lines: 12771
Relevant Lines: 12990

💛 - Coveralls

@JSkimming JSkimming deleted the add-support-for-json-object branch September 28, 2025 08:44
@JSkimming
Copy link
Contributor Author

Thanks for responding so quickly.

I ended up watching From Dusk Till Dawn. I hope your son enjoyed Tron Legacy @dennisdoomen. I've taken my kids on a classic movie journey. Enjoy it.

dennisdoomen pushed a commit to dennisdoomen/fluentassertions that referenced this pull request Sep 28, 2025
This was referenced Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recieving CS0121: The call is ambiguous... compilation error with release 8.7.0

4 participants