[Mono-bugs] [Bug 81296][Min] Changed - System.Diagnostics configuration sometimes doesn't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Apr 29 22:03:05 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 jonpryor at vt.edu.

http://bugzilla.ximian.com/show_bug.cgi?id=81296

--- shadow/81296	2007-04-03 10:19:53.000000000 -0400
+++ shadow/81296.tmp.25261	2007-04-29 22:03:05.000000000 -0400
@@ -10,13 +10,12 @@
 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.
@@ -99,6 +98,79 @@
 
 
 ------- Additional Comments From noix at sphere.pl  2007-04-03 10:19 -------
 Created an attachment (id=18997)
 .config file demonstrating the problem
 
+
+------- Additional Comments From jonpryor at vt.edu  2007-04-29 22:03 -------
+Apologies for taking so long to look at this; I hadn't seen it in my
+mono-bugzilla email.  If you hadn't emailed mono-devel-list I might
+not have seen it...
+
+I have some good news, and some bad news.
+
+The good news: I can reproduce it, I've run it through mdb (mdb works!
+ may wonders never cease), and I've found the problem.
+
+The bad news: the problem is that System.Xml is broken here.  Not sure
+why.
+
+jon at balthasar:tmp$ mdb 81296.exe
+Mono Debugger
+(mdb) b System.Diagnostics.DiagnosticsConfigurationHandler.AddSwitchesNode
+Breakpoint 1 at
+System.Diagnostics.DiagnosticsConfigurationHandler.AddSwitchesNode
+(mdb) r
+Starting program: 81296.exe 
+Thread @1 stopped at #0: 0xb734a6b2 in
+SwitchTest.Program.Main(System.String[])+0x12 at
+/home/jon/tmp/81296.cs:10.
+  10            TraceSwitch ts = new TraceSwitch("t", "t");
+(mdb) c
+Thread @1 hit breakpoint 1 at #0: 0xb6ea2be4 in
+System.Diagnostics.DiagnosticsConfigurationHandler.AddSwitchesNode(System.Collections.IDictionary,System.Xml.XmlNode)+0x44
+at
+/area-51/Development/mono-HEAD/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs:163.
+ 163                    ValidateInvalidAttributes (node.Attributes, node);
+(mdb) n
+Thread @1 stopped at #0: 0xb6ea2c05 in
+System.Diagnostics.DiagnosticsConfigurationHandler.AddSwitchesNode(System.Collections.IDictionary,System.Xml.XmlNode)+0x65
+at
+/area-51/Development/mono-HEAD/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs:165.
+ 165                    IDictionary newNodes = new Hashtable ();
+(mdb) n
+Thread @1 stopped at #0: 0xb6ea2c25 in
+System.Diagnostics.DiagnosticsConfigurationHandler.AddSwitchesNode(System.Collections.IDictionary,System.Xml.XmlNode)+0x85
+at
+/area-51/Development/mono-HEAD/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs:167.
+ 167                    foreach (XmlNode child in node.ChildNodes) {
+(mdb) p node.OuterXml
+(System.String) "<switches><add name="t" value="1" /></switches>"
+
+Notice here how `node' actually has a value, and it's the appropriate
+section of your .config file.  This is good.
+
+(mdb) n
+Thread @1 stopped at #0: 0xb6ea2e33 in
+System.Diagnostics.DiagnosticsConfigurationHandler.AddSwitchesNode(System.Collections.IDictionary,System.Xml.XmlNode)+0x293
+at
+/area-51/Development/mono-HEAD/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs:197.
+ 197                    }
+
+And this is where things go horribly wrong.  Line 197 is the _end_ of
+the `foreach' loop.  Notice how NO nodes were processed (thus no
+switches were added to the `newNodes' dictionary, so we'll never find
+the switch value from the TraceSwitch instance).
+
+Doubly interesting is this:
+
+(mdb) p node.FirstChild
+(System.Configuration.ConfigXmlDocument/ConfigXmlElement) { fileName =
+"/home/jon/tmp/81296.exe.config", lineNumber = 1 }
+
+So there is definately a child node in there -- as shown by *both*
+.OuterXml and .FirstChild -- but the `foreach' loop never executes it.
+
+Atsushi: Any chance you could figure out why the XmlNode enumeration
+is broken here?  Or should I try to create a smaller test case?
+


More information about the mono-bugs mailing list