[Mono-bugs] [Bug 81296][Min] New - System.Diagnostics configuration sometimes doesn't work
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Apr 3 10:18:16 EDT 2007
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by noix at sphere.pl.
http://bugzilla.ximian.com/show_bug.cgi?id=81296
--- shadow/81296 2007-04-03 10:18:16.000000000 -0400
+++ shadow/81296.tmp.5285 2007-04-03 10:18:16.000000000 -0400
@@ -0,0 +1,94 @@
+Bug#: 81296
+Product: Mono: Class Libraries
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: Debian SID
+Status: NEW
+Resolution:
+Severity: Unknown
+Priority: Minor
+Component: System
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: noix at sphere.pl
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: System.Diagnostics configuration sometimes doesn't work
+
+Description of Problem:
+system.diagnostics section of application config sometimes doesn't work.
+I'll demonstrate it with a broken TraceSwitch, but I believe the same bug
+triggers also other problems.
+
+Steps to reproduce the problem:
+1. compile "attached" SwitchTest.cs
+2. run it with "attached" SwitchTest.exe.config
+
+Actual Results:
+It prints out "Level: Off"
+
+Expected Results:
+"Level: Error" (as specified in .config)
+
+How often does this happen?
+Every time.
+
+Additional Information:
+The problem is triggered by a TextWriterTraceListener in addition to a
+ConsoleTraceListener.
+Commenting out the second listener in TestSwitch.exe.config "solves" the
+problem.
+
+I tried to track down the problem, but having no experience in Mono, I
+couldn't find the exact place of error.
+
+However, I could establish that:
+DiagnosticsConfigurationHandler.AddTraceListeners is called several times,
+every time trying to add all listeners (I believe it shouldn't!)
+AddTraceListener throws a "Sharing violation on path log.log" exception
+when called for the second time.
+I guess that after such exception the whole system.diagnostics config
+section becomes broken in the application (but it's just a guess).
+
+
+Files used:
+
+--- SwitchTest.cs ---
+using System;
+using System.Diagnostics;
+
+namespace SwitchTest
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ TraceSwitch ts = new TraceSwitch("t", "t");
+ Console.WriteLine("Level: {0}", ts.Level);
+ }
+ }
+}
+--- End of SwitchTest.cs ---
+
+--- SwitchTest.exe.config ---
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <system.diagnostics>
+ <switches>
+ <add name="t" value="1" />
+ </switches>
+ <trace>
+ <listeners>
+ <clear/>
+ <add name="configConsoleListener"
+type="System.Diagnostics.ConsoleTraceListener" />
+ <add name="logfileListener"
+
+type="System.Diagnostics.TextWriterTraceListener"
+ initializeData="log.log" />
+ </listeners>
+ </trace>
+ </system.diagnostics>
+</configuration>
+--- End of SwitchTest.exe.config ---
More information about the mono-bugs
mailing list