Unfortunately, the API is confused here, and certain overloads change the behavior. Method-level documentation does not describe methods well, and finding a (decompiled) source is useful for answering this question.
Trace.Write/WriteLine(string) are abstract methods that the implementation redefines for the actual โwriteโ to the underlying streams, and any data that has been written will be received regardless of the trace / source configuration.
Trace.Write/WriteLine(object) (and other overloads) should be effectively treated as "Trace.WriteVerbose" because they use the Verbose ShouldTrace filter.
therefore
To directly access the base stream / provider, bypassing the filters, use Trace.Write/WriteLine(string) .
This trace text will always be written.
To write an informational message, use Trace.TraceInformation . This calls Trace.WriteLine(string) with a TraceEvent that applies an information filter. Trace.TraceXYZ also emits headers and footers.
This trace event will be recorded when tracking information.
To write text, use Trace.WriteLine(object) (or other overloads).
This text will only be written if Verbose is traceable.
All forms of Trace.Write/WriteLine bypass additional trace formatting and write to the main trace implementation stream.
source share