Consider the following test program:

using System;
using System.Diagnostics;

public class Foo
{
        public static void Main()
        {
                var t = new TraceSource("Test", SourceLevels.All);
                Console.WriteLine(t.Switch.Level.ToString());
        }
}


If you run this using Microsoft.NET, it prints "All".  
If you run it with mono-2.8.1, mono prints "Off".

I believe the following patch fixes the problem, but I do not know if
this is the correct fix.

diff -r b99a9b69c1b6 mcs/class/System/System.Diagnostics/TraceSource.cs
--- a/mcs/class/System/System.Diagnostics/TraceSource.cs        Wed Jan 05 
13:34:32 2011 -0500
+++ b/mcs/class/System/System.Diagnostics/TraceSource.cs        Fri Jan 07 
15:54:48 2011 -0600
@@ -54,11 +54,11 @@
                        Hashtable sources = DiagnosticsConfiguration.Settings 
["sources"] as Hashtable;
                        TraceSourceInfo info = sources != null ? sources [name] 
as TraceSourceInfo : null;
                        source_switch = new SourceSwitch (name);
+                       source_switch.Level = sourceLevels
 
                        if (info == null)
                                listeners = new TraceListenerCollection ();
                        else {
-                               source_switch.Level = info.Levels;
                                listeners = info.Listeners;
                        }
                }
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to