By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,478 Members | 1,833 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,478 IT Pros & Developers. It's quick & easy.

Bug in Debug.Listeners?

P: n/a
When I code:
Debug.Assert(false, "this is a message");
it works fine, and out comes the dialog box.

When I code
Trace.Listeners.Clear();
Debug.Assert(false, "this is a message");

No message is output.
In the debugger I see that clearing the Trace Listeners clears the Debug
Listeners. This is a problem since I am using the Trace Listeners for
logging and the debug listeners for debugging. Is this a bug? I am using
C# standard, MDE 2002.
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Fred Mellender wrote:
When I code:
Debug.Assert(false, "this is a message");
it works fine, and out comes the dialog box.

When I code
Trace.Listeners.Clear();
Debug.Assert(false, "this is a message");

No message is output.
In the debugger I see that clearing the Trace Listeners clears the Debug
Listeners. This is a problem since I am using the Trace Listeners for
logging and the debug listeners for debugging. Is this a bug? I am using
C# standard, MDE 2002.


I don't think MS considers this a bug - the Debug and Trace classes
share the same set of listeners. I agree with you that this should not
be the case. It's a total break of OO encapsulation.

You might want to look into the log4net logging framework.

--
mikeb

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.