2009-04-28 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 28 Apr 2009 17:47:15 +0000 (17:47 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 28 Apr 2009 17:47:15 +0000 (17:47 -0000)
* ConsoleTraceListener.cs: add an internal constructor that takes a
string argument. Used when 'initializeData' is set.
* DiagnosticsConfigurationHandler.cs: try internal constructors when
the assembly is System.
Fixes bug #498853.

svn path=/trunk/mcs/; revision=132868

mcs/class/System/System.Diagnostics/ChangeLog
mcs/class/System/System.Diagnostics/ConsoleTraceListener.cs
mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs

index 98c54879ee1890062a68a734ee111ad7f949c89e..f08674891c680b62f0925265123d6425be2fbfb6 100644 (file)
@@ -1,3 +1,11 @@
+2009-04-28 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * ConsoleTraceListener.cs: add an internal constructor that takes a
+       string argument. Used when 'initializeData' is set.
+       * DiagnosticsConfigurationHandler.cs: try internal constructors when
+       the assembly is System.
+       Fixes bug #498853.
+
 2009-04-19  Miguel de Icaza  <miguel@novell.com>
 
        * Process.cs: Do not crash if GetProcesses_internal returns null
index eb4143afed7d37fb90b34a1190c089bfda952bc2..3c523b27583cd873c0955023abdf409593447e55 100644 (file)
@@ -33,7 +33,10 @@ namespace System.Diagnostics {
                public ConsoleTraceListener () : this (false) {}
                public ConsoleTraceListener (bool useErrorStream) :
                        base (useErrorStream ? Console.Error : Console.Out) {}
+
+               internal ConsoleTraceListener (string data) :
+                       this (Convert.ToBoolean (data)) {}
        }
 }
 
-#endif
\ No newline at end of file
+#endif
index 15988c2ad7d03465328cfa721f2a9e87276d1895..3dd95ad8c5c39a64468dfa5cf18d30f583abd62c 100644 (file)
@@ -35,6 +35,7 @@ using System;
 using System.Collections;
 using System.Collections.Specialized;
 using System.Configuration;
+using System.Reflection;
 using System.Threading;
 #if (XML_DEP)
 using System.Xml;
@@ -454,7 +455,11 @@ namespace System.Diagnostics
                                types = Type.EmptyTypes;
                        }
 
-                       System.Reflection.ConstructorInfo ctor = t.GetConstructor (types);
+                       BindingFlags flags = BindingFlags.Public | BindingFlags.Instance;
+                       if (t.Assembly == GetType ().Assembly)
+                               flags |= BindingFlags.NonPublic;
+
+                       ConstructorInfo ctor = t.GetConstructor (flags, null, types, null);
                        if (ctor == null) 
                                throw new ConfigurationException ("Couldn't find constructor for class " + type);