Live Chat Icon For mobile
Live Chat Icon

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();
	}

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.