Why am I getting duplicate trace messages for my trace statements

Platform: WinForms|Category: Debugging

This is possible if the same listener was added more than once to the Listeners list in Trace. This is possible even if an assembly that you linked do makes an additional entry for the same listener.

Perform a check like this before adding a listener.

	if(Trace.Listeners.Count == 0)
	{
		Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
		Trace.AutoFlush = true;
		Trace.Indent();
	}