TraceListener.Close when added in the config file...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have written a trace listener that has at least one worker thread to process an internal buffer. When Close is called explicitely in the tracelistener hosting application, everthing is fine and dandy. if i add the TraceListener from the system.diagnostics section of the config file, the Close method doesn't ever get called. Does anyone have any idea when that method gets called when added through the config file?
 
So it turns out I just didn't really understand how Background and non-background threads affect a process' life. A background thread will not halt a process from ending, where-as a non-background thread will. Due to this behavior and the fact that the trace subsystem probably uses the end of the process as its trigger for releasing dynamically added listeners, there is a deadlock. Oh well... back to the drawing board
 
Ryan,

This is a known problem (IMO). The only solution is to add a destructor to
your class and clean up there. The framework will not call
{TraceListener}.Close() or explicitly dispose of the reference.


--
____________________
Klaus H. Probst, MVP
http://www.vbbox.com/

Ryan Cromwell said:
I have written a trace listener that has at least one worker thread to
process an internal buffer. When Close is called explicitely in the
tracelistener hosting application, everthing is fine and dandy. if i add
the TraceListener from the system.diagnostics section of the config file,
the Close method doesn't ever get called. Does anyone have any idea when
that method gets called when added through the config file?
 
Back
Top