It's searching the output to ensure the id doesn't get written out, so it can't match other IDs that are written out.
Commit migrated from https://github.com/dotnet/corefx/commit/
05233fd0c0200f1fda258bab148bbae28592892d
[Fact]
public void ListenerWithFilter()
{
- int processId;
+ // Ensure we use an arbitrary ID that doesn't match the process ID or thread ID.
+ int traceTransferId = 1;
using (Process p = Process.GetCurrentProcess())
{
- processId = p.Id;
+ while (traceTransferId == p.Id || traceTransferId == Environment.CurrentManagedThreadId)
+ {
+ traceTransferId++;
+ }
}
- // Ensure we use an arbitrary ID that doesn't match the process ID.
- int traceTransferId = processId + 1;
-
string file = GetTestFilePath();
Guid guid = Guid.NewGuid();
using (var listener = new XmlWriterTraceListener(file))