Bug in Debug.Listeners?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fred Mellender

    #1

    Bug in Debug.Listeners?

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

    When I code
    Trace.Listeners .Clear();
    Debug.Assert(fa lse, "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.


  • mikeb

    #2
    Re: Bug in Debug.Listeners ?

    Fred Mellender wrote:
    [color=blue]
    > When I code:
    > Debug.Assert(fa lse, "this is a message");
    > it works fine, and out comes the dialog box.
    >
    > When I code
    > Trace.Listeners .Clear();
    > Debug.Assert(fa lse, "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.
    >
    >[/color]

    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

    Comment

    Working...