This project has moved and is read-only. For the latest updates, please go here.


Using TestServer results in plethora of TraceListeners


Every time you use a TestServer in a unit test, another TraceListener is added to Trace.Listeners. This causes a substantial buildup of duplicate tracing.

Workaround is periodically call Trace.Listeners.Clear()
Closed Mar 2, 2017 at 10:41 PM by mgirgin


pruett wrote Nov 30, 2015 at 8:01 AM

This issue is pretty frustrating from a unit test perspective. The workaround of calling Trace.Listeners.Clear() will stop all other test output as well.

A modification to the workaround that i required is...
As far as I know trace listeners are only appended to the Trace.Listeners collection.