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
13 changes: 11 additions & 2 deletions src/Build.UnitTests/BackEnd/LoggingService_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,12 @@ public void ProcessLoggingEventConcurrentWithShutdown_DoesNotThrow()

LoggingService loggingService = (LoggingService)LoggingService.CreateLoggingService(LoggerMode.Asynchronous, 1);
((IBuildComponent)loggingService).InitializeComponent(mockHost);
loggingService.RegisterLogger(new ConsoleLogger());

loggingService.RegisterLogger(new MockLogger());

Exception loggingThreadException = null;
loggingService.OnLoggingThreadException += ex =>
Interlocked.CompareExchange(ref loggingThreadException, ex, null);

using ManualResetEvent startSignal = new ManualResetEvent(false);
Exception caughtException = null;
Expand All @@ -1166,7 +1171,10 @@ public void ProcessLoggingEventConcurrentWithShutdown_DoesNotThrow()
{
try
{
BuildMessageEventArgs msg = new BuildMessageEventArgs($"Message {i}", null, null, MessageImportance.Low);
BuildMessageEventArgs msg = new BuildMessageEventArgs($"Message {i}", null, null, MessageImportance.Low)
{
BuildEventContext = new BuildEventContext(0, 0, 0, 0),
};
loggingService.ProcessLoggingEvent(msg);
}
catch (Exception ex)
Expand All @@ -1186,6 +1194,7 @@ public void ProcessLoggingEventConcurrentWithShutdown_DoesNotThrow()
bool joined = logThread.Join(TimeSpan.FromSeconds(10));
joined.ShouldBeTrue("Logging thread did not terminate within the allotted time.");
caughtException.ShouldBeNull();
loggingThreadException.ShouldBeNull();
}

#endregion
Expand Down
Loading