Skip to content

Commit b5f62f7

Browse files
committed
Fix test failures that occur due to Xunit.v3 v2's new TraceListener
1 parent 5370ecd commit b5f62f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/Microsoft.VisualStudio.Validation.Tests/AssertDialogSuppression.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ public AssertDialogSuppression()
3333
this.originalAssertUiSetting = assertDialogListener.AssertUiEnabled;
3434
assertDialogListener.AssertUiEnabled = false;
3535
}
36+
37+
// Xunit.v3 v2 also adds a TraceListener that throws on failure, so remove that too.
38+
// See also https://github.com/xunit/xunit/issues/3317.
39+
// My mechanism for removing the listener is designed to work before and after that issue is resolved.
40+
if (Trace.Listeners.OfType<Xunit.Internal.TraceAssertOverrideListener>().FirstOrDefault() is { } listener)
41+
{
42+
Trace.Listeners.Remove(listener);
43+
}
3644
#endif
3745
}
3846

0 commit comments

Comments
 (0)