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

Upgrade to FluentAssertions 5.5.0 yields: System.MissingMethodException #27

Closed
dstj opened this issue Nov 9, 2018 · 12 comments · Fixed by fluentassertions/fluentassertions#977
Assignees

Comments

@dstj
Copy link
Contributor

dstj commented Nov 9, 2018

After upgrading FluentAssertions from 5.4.2 to 5.5.0, the following code:

var actualString = @"<JSON HERE>";
var expectedString = @"<JSON HERE>";
var actual = JsonParsingHelper.Parse(actualString);
var expected = JsonParsingHelper.Parse(expectedString);
actual.Should().BeEquivalentTo(expected);

produces the following error:

System.MissingMethodException : Method not found: 'FluentAssertions.Execution.AssertionScope FluentAssertions.Execution.AssertionScope.ForCondition(Boolean)'.
   at FluentAssertions.Json.JTokenAssertions.HaveElement(String expected, String because, Object[] becauseArgs)
@dstj dstj closed this as completed Nov 9, 2018
@dstj dstj reopened this Nov 9, 2018
@dennisdoomen dennisdoomen self-assigned this Nov 10, 2018
@ghost
Copy link

ghost commented Nov 19, 2018

any progress on this? I'm getting the same error after upgrading

@dennisdoomen
Copy link
Member

Sorry. Forgot about the other repo. Will take a look soon.

@dennisdoomen
Copy link
Member

Hmm, looks like I've introduced a breaking change in the main library without me realizing it.

cc @jnyrup

@jnyrup
Copy link
Member

jnyrup commented Nov 19, 2018

@dennisdoomen Probably due to fluentassertions/fluentassertions#925
AssertionScope.ForCondition changed return type from AssertionScope to IAssertionScope, so the function signature is changed.

@dennisdoomen
Copy link
Member

Yep. Trying to figure out how we can fix this.

@dennisdoomen
Copy link
Member

Looks like the only way to fix this is to have FluentAssertions.Json take a direct dependency on FluentAssertions 5.5.0+. Technically, that's a breaking change..

@jnyrup
Copy link
Member

jnyrup commented Nov 19, 2018

I guess the breaking change also affects all other nuget packages depending on 5.0.0+?

@dennisdoomen
Copy link
Member

If they directly use the AssertionScope, yes.

@dennisdoomen
Copy link
Member

And you did mention the potential for breaking changes while you reviewed fluentassertions/fluentassertions#925 😢

@jnyrup
Copy link
Member

jnyrup commented Nov 19, 2018

We might be able to fix it by using explicit interface implementation of IAssertionScope in AssertionScope.

I tried it, and here are my results:

One exception is Continuation also changed Then from returning an AssertionScope to an IAssertionScope

@dennisdoomen
Copy link
Member

That was exactly what I was thinking as well.

@dennisdoomen
Copy link
Member

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

Successfully merging a pull request may close this issue.

3 participants