Oct 7, 2009 at 12:42 PM
Edited Oct 7, 2009 at 1:54 PM


First of all thanks for the great project!

Now for my question, on line 149 in the "Trace" function within the ClassicProvider class I found the following if-statement:

if (!this.enabled ||
    (this.Flags & traceFlags) != traceFlags ||
     this.Level <= traceLevel)

Isn't the first function argument (EtwTraceFlag traceFlag) supposed to be used in the second line of this expression instead of the class variable traceFlags?
"this.Flags" is a property that returns "this.traceFlags", so "(this.Flags & traceFlags)" will obviously result in just the value of "this.traceFlags" and thus the 'does not equal' expression will always return false since the same variables are being compared.

if(!this.enabled ||
   (this.Flags & traceFlag) != traceFlag ||
    this.Level <= traceLevel)
Oct 7, 2009 at 10:25 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Oct 7, 2009 at 10:25 PM

Dear lord; you are correct! Our optimization is sub-optimal; we'll always barrel through to log as long as the level is high enough. I've logged a bug on it.