-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
I just discovered that creation of new event log and sources is not thread safe. It is failing during our tests as they are executed in parallel.
if (System.Diagnostics.EventLog.SourceExists(source, log.MachineName))
{
var existingLogWithSourceName = System.Diagnostics.EventLog.LogNameFromSourceName(source, log.MachineName);
if (!string.IsNullOrWhiteSpace(existingLogWithSourceName) &&
!log.Log.Equals(existingLogWithSourceName, StringComparison.OrdinalIgnoreCase))
{
// Remove the source from the previous log so we can associate it with the current log name
System.Diagnostics.EventLog.DeleteEventSource(source, log.MachineName);
oldLogName = existingLogWithSourceName;
}
}
else
{
System.Diagnostics.EventLog.CreateEventSource(sourceData);
}nblumhardt
Metadata
Metadata
Assignees
Labels
No labels