[Mono-bugs] [Bug 682537] New: System.Diagnostics.SourceSwitch doesn't filter correctly

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Mar 25 01:58:32 EDT 2011



           Summary: System.Diagnostics.SourceSwitch doesn't filter
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: john.sietsma at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer
           Blocker: ---

Description of Problem:

Steps to reproduce the problem:
This code will assert when it shouldn't.
SourceSwitch ss = new SourceSwitch("Test");
ss.Level = SourceLevels.Warning;
Assert.IsFalse( ss.ShouldTrace(TraceEventType.Information) );

Actual Results:
SourceSwitch.ShouldTrace should only return true when the trace event level is
higher then the source level set.

Expected Results:

How often does this happen? 
All the time.

Additional Information:
The tests in SourceSwitchTest.cs only test verbose and activity tracing. They
should also test various levels such as information and warning.

The ShouldTrace function has a bug in it's bit operations.
Currently they look like this:
return (Level & SourceLevels.Critical) != 0;

They shouldn't test equality to 0 but to the current level like this:
return (Level & SourceLevels.Critical) != Level;

This isn't enough to fix the bug, ActivityTracing is still broken.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list