Fluent Assertions "Maximum recursion depth was reached…"

Viewed 1217

I have a number of nested complex objects that I'm attempting to compare with Fluent Assertions with the following code:

restResponse.Should().BeEquivalentTo(mappedSoapResponse, options =>
            {
                options.AllowingInfiniteRecursion();
                options.IgnoringCyclicReferences();
                return options;
            });

Despite this however I keep hitting an issue with "Maximum recursion depth was reached…" despite specially enabling infinite recursion.

1 Answers

Have you tried adding this beforehand

AssertionOptions.FormattingOptions.MaxDepth = 100;
Related