recently I found our company product (based on .net framework) uses Tracelistenser Class's (under the System.Diagnostics) WriteLine method.
foreach(TraceListener item in traceSource.Listeners)
{
item.WriteLine($"...");
item.Flush;
}
Because there is a WriteLineAsync method for the StreamWriter (under the System.IO), I started to think that Tracelistenser's WriteLine method must be a synchronous method. But after searching the source code, I found no clause indicating Tracelistenser's WriteLine is the synchronous method. I just want to know if is there any idea regarding this method?
Besides, the TraceListener inherits MarshalByRefObject,
public abstract class TraceListener : MarshalByRefObject, IDisposable
and the Microsoft doc describes it
as the base class for objects that communicate across application domain boundaries by exchanging messages using a proxy.
Can I consider that this base object could transfer data cross processes? If so, when its derived object TraceListener calls WriteLine, the method is actually writing cross processes, such as writing data into a text note or window's event log?