-
Notifications
You must be signed in to change notification settings - Fork 721
Closed
Closed
Copy link
Labels
Description
Description
The 8.1.0 release introduced a bug where we receive a NullReferenceException when capturing tracing. Below is the stack trace.
Xunit.Runner.InProc.SystemConsole.TestingPlatform.XunitException: System.NullReferenceException : Object reference not set to an instance of an object.
at FluentAssertions.Equivalency.Tracing.StringBuilderTraceWriter.WriteLine(String trace)
at FluentAssertions.Equivalency.Tracing.StringBuilderTraceWriter.AddBlock(String trace)
at FluentAssertions.Equivalency.Tracing.Tracer.WriteBlock(GetTraceMessage getTraceMessage)
at FluentAssertions.Equivalency.EquivalencyValidator.TryToProveNodesAreEquivalent(Comparands comparands, IEquivalencyValidationContext context)
at FluentAssertions.Equivalency.EquivalencyValidator.AssertEquivalencyOf(Comparands comparands, IEquivalencyValidationContext context)
at FluentAssertions.Equivalency.EquivalencyValidator.RecursivelyAssertEquivalencyOf(Comparands comparands, IEquivalencyValidationContext context)
at FluentAssertions.Equivalency.EquivalencyValidator.AssertEquality(Comparands comparands, EquivalencyValidationContext context)
at FluentAssertions.Collections.StringCollectionAssertions`2.BeEquivalentTo(IEnumerable`1 expectation, Func`2 config, String because, Object[] becauseArgs)
Reproduction Steps
new[] { "a" }.Should().BeEquivalentTo(["a"], c => c.WithTracing(new StringBuilderTraceWriter()));
Expected behavior
The trace should be written to the StringBuilderTraceWriter
.
Actual behavior
Throws a NullReferenceException
Regression?
It worked fine in 8.0.1
. I've tried the latest 8.1.1
, and the bug still occurs.
Known Workarounds
Don't do tracing?
Configuration
Version: 8.1.0
.NET 9
Other information
No response
Are you willing to help with a pull-request?
Yes, please assign this issue to me.