Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion tests/Common/Utils/XunitLoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,20 @@ public void Log<TState>(
sb.Append(exception.ToString());
}

output.WriteLine(sb.ToString());
try
{
output.WriteLine(sb.ToString());
}
catch (InvalidOperationException)
{
// Ignore exceptions from xUnit's TestOutputHelper when the test has already completed.
// Background work may continue logging after xUnit has disposed the test context.
}
catch (NullReferenceException)
{
// xUnit v3 may throw NullReferenceException in TestOutputHelper.QueueTestOutput()
// when the internal queue has been torn down after test completion.
}
}

public bool IsEnabled(LogLevel logLevel) => true;
Expand Down