Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with FluentAssertions 8.0.1 #38

Open
Robert-Ed-Smith opened this issue Jan 27, 2025 · 18 comments
Open

Issue with FluentAssertions 8.0.1 #38

Robert-Ed-Smith opened this issue Jan 27, 2025 · 18 comments

Comments

@Robert-Ed-Smith
Copy link

Upon upgrading from Fluent Assertions from 7.1.0 to 8.0.1 I see

System.MissingMethodException : Method not found: 'Void FluentAssertions.Primitives.ReferenceTypeAssertions`2..ctor(!0)'.

This looks very similar to the issue #22 for a previous upgrade.

The generating code is very simple

InMemorySink.Instance
.Should()
.HaveMessage();

Works with 7.1.0, fails with given message on 8.0.1

@sandermvanvliet
Copy link
Contributor

It sure looks similar but the solution will be much more complicated unfortunately.

FluentAssertions 8 introduces a lot of breaking changes which means I can no longer depend on whatever someone includes in their project when using Serilog.Sinks.InMemory.Assertions.

I need to have a think about how to solve this.

@jimmyrn
Copy link

jimmyrn commented Jan 29, 2025

Maybe consider to go away from FluentAssertions after they changed the licensing in version 8.
Shouldly (https://github.com/shouldly/shouldly) seems like a good replacement,

@sandermvanvliet
Copy link
Contributor

That’s immaterial to this library.

If there are enough requests to provide extensions to Shouldly I might consider adding that but right now this library supports FluentAssertions and that won’t change.

@sandermvanvliet
Copy link
Contributor

@Robert-Ed-Smith i have a potential solution that I’m testing right now although that comes at the cost of dropping support for .Net Framework (4.8 and below)

So far the tests for net core look good and I think it’s a workable solution but I want to ensure I have a working approach before I bump the package to NuGet

@Robert-Ed-Smith
Copy link
Author

Thank-you - we will probably revert to the prior version of FluentAssertions - I think the new licensing costs are very high. We will look into the alternative you suggest as well. Thank you for the suggestion

@sandermvanvliet
Copy link
Contributor

@Robert-Ed-Smith would you mind having a test of the pre release packages available here and let me know if that works?

Even if using FluentAssertions 6, that would be helpful to know if I didn't introduce any breaking changes.

@Robert-Ed-Smith
Copy link
Author

Yes will test with the upgraded version (8.0.1) and then roll back to 7.1.0 and test with that

@sandermvanvliet
Copy link
Contributor

Sorry, just noticed you're using version 7 so i just pushed a new version that supports it.

Have a look at these packages

@Robert-Ed-Smith
Copy link
Author

The first version (as you expected) worked fine with 8 but failed on 7.

That (latest) version works with both version 8 and version 7.

As I mention, because of the licensing costs we will revert back to version 7 of Fluent Assertions anyway, at least for now

@sandermvanvliet
Copy link
Contributor

Thanks for testing it. I’ll let it percolate for a few days and then push out a new package to NuGet

@jcfnomada
Copy link

Will you consider using AwesomeAssertions? It's a fork of FluentAssertions that preserves the latest developments up until the license change. We keep the same namespace, so nothing breaks. By switching, you'll be supporting OpenSource and calling out a decision that disrespected previous contributors.

@Robert-Ed-Smith
Copy link
Author

Yes definitely. We will take a look at that.

@Robert-Ed-Smith
Copy link
Author

We've tried to swich from FluentAssertions 7.1 to AwesomeAssertions on version 8.0

Everything works fine with those two patched versions - which are not yet pushed to NuGet repository I think.. If you could push .those versions then we can switch across to AwesomeAssertions

@jcfnomada
Copy link

@Robert-Ed-Smith you can find 7.1.0 and 8.0.0 version in nuget: https://www.nuget.org/packages/AwesomeAssertions

@Robert-Ed-Smith
Copy link
Author

Sorry no, unless I misunderstand you, I mean the SeriLog.Sinks.InMemory and Seriloig.Sinks.InMemory.Assertions - we need to use the patches (version 12.1) that you listed in this ticket for it to work. (Otherwise we get a similar error to what we were seeing at the top of this post).

I can still only see version 11.0 in NuGet.

@sandermvanvliet
Copy link
Contributor

@Robert-Ed-Smith the assertions package here does not support AwesomeAssertions (not yet anyway). Using those packages in your project will not make these assertions provided by this package work.

@jcfnomada
Copy link

Yes AwesomeAssertions doesn't solve exactly this issue. It will require some rework, and actually moving away from FluentAssertions. The only and probably best solution would be to create a new package for example Serilog.Sinks.InMemory.AwesomeAssertions. But that is another issue, so sorry for messing with your work.

@sandermvanvliet
Copy link
Contributor

No need to be sorry 🙂

With the changes I’ve made it actually may be much simpler to support that.

It’s just that I need to have a little bit of free time to work on that, only free time is a bit limited right now…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants