Skip to content

Commit f66de6b

Browse files
committed
Wrap System.Diagnostics.EventLogEntryType, because it weirdly causes the coverlet.collector to hang
1 parent e2abdf7 commit f66de6b

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/Dibix.Testing/Utilities/TestResultComposer.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ string FormatContent(EventLogEntry entry)
8484
Enumerable.Range(0, eventLog.Entries.Count)
8585
.Reverse()
8686
.Select(x => eventLog.Entries[x])
87-
.Where(x => x.EntryType != 0 /* ?? */ && eventLogEntryType.HasFlag(x.EntryType))
87+
.Where(x => x.EntryType != 0 /* ?? */ && ((System.Diagnostics.EventLogEntryType)eventLogEntryType).HasFlag(x.EntryType))
8888
.Take(count)
8989
.Each((x, i) => this.AddFile($"EventLogEntry_{i + 1}_{x.EntryType}.txt", FormatContent(x)));
9090
}
@@ -204,5 +204,16 @@ private static string BuildDedicatedRunDirectory(TestContext testContext)
204204
string path = Path.Combine(Path.GetTempPath(), "TestResults", directoryName, assemblyName);
205205
return path;
206206
}
207+
208+
// Exposing the original enum System.Diagnostics.EventLogEntryType in the AddLastEventLogEntries method, causes the coverlet.collector to hang.
209+
// Might be related to: https://github.com/coverlet-coverage/coverlet/issues/1044
210+
public enum EventLogEntryType
211+
{
212+
Error = 1,
213+
Warning = 2,
214+
Information = 4,
215+
SuccessAudit = 8,
216+
FailureAudit = 16
217+
}
207218
}
208219
}

0 commit comments

Comments
 (0)