Author: miguel
Date: 2007-12-10 17:45:06 -0500 (Mon, 10 Dec 2007)
New Revision: 91070
Modified:
trunk/mcs/class/System/System.Diagnostics/ChangeLog
trunk/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs
Log:
07-12-10 Miguel de Icaza <[EMAIL PROTECTED]>
* DefaultTraceListener.cs: By default set the AssertUiEnabled to
false, as this is what we had previously and some broken
applications (Tomboy) are too trigger happy with Debug.Assert.
Also, we now load the Windows.Forms code on demand, instead of
preloading it on the static ctor to reduce memory usage.
Modified: trunk/mcs/class/System/System.Diagnostics/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Diagnostics/ChangeLog 2007-12-10 22:30:08 UTC
(rev 91069)
+++ trunk/mcs/class/System/System.Diagnostics/ChangeLog 2007-12-10 22:45:06 UTC
(rev 91070)
@@ -1,3 +1,12 @@
+2007-12-10 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * DefaultTraceListener.cs: By default set the AssertUiEnabled to
+ false, as this is what we had previously and some broken
+ applications (Tomboy) are too trigger happy with Debug.Assert.
+
+ Also, we now load the Windows.Forms code on demand, instead of
+ preloading it on the static ctor to reduce memory usage.
+
2007-12-08 Gert Driesen <[EMAIL PROTECTED]>
* LocalFileEventLog.cs: To allow entry to be fully written before
Modified: trunk/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs
===================================================================
--- trunk/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs
2007-12-10 22:30:08 UTC (rev 91069)
+++ trunk/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs
2007-12-10 22:45:06 UTC (rev 91070)
@@ -57,9 +57,6 @@
private static readonly string MonoTracePrefix;
private static readonly string MonoTraceFile;
- private static readonly object
messageBoxButtonsAbortRetryIgnore;
- private static readonly MethodInfo msgboxShow;
-
static DefaultTraceListener ()
{
// Determine what platform we're on. This impacts how
where we send
@@ -110,19 +107,6 @@
MonoTracePrefix = prefix;
}
}
-
- // AssertUiEnabled support
- try {
- Assembly wfAsm = Assembly.Load
(Consts.AssemblySystem_Windows_Forms);
- if (wfAsm != null) {
- Type buttons = wfAsm.GetType
("System.Windows.Forms.MessageBoxButtons");
- messageBoxButtonsAbortRetryIgnore =
Enum.Parse (buttons, "AbortRetryIgnore");
- msgboxShow = wfAsm.GetType
("System.Windows.Forms.MessageBox").GetMethod ("Show", new Type [] {typeof
(string), typeof (string), buttons});
- }
- } catch {
- // failed to load the assembly (likely when
- // MWF is not installed).
- }
}
/**
@@ -153,7 +137,7 @@
private string logFileName = null;
- private bool assertUiEnabled = true;
+ private bool assertUiEnabled = false;
public DefaultTraceListener () : base ("Default")
{
@@ -185,9 +169,30 @@
DialogResult ProcessUI (string message, string detailMessage)
{
- if (!AssertUiEnabled || msgboxShow == null ||
messageBoxButtonsAbortRetryIgnore == null)
+
+ if (!AssertUiEnabled)
return DialogResult.None;
+ object messageBoxButtonsAbortRetryIgnore;
+ MethodInfo msgboxShow;
+
+ try {
+ Assembly wfAsm = Assembly.Load
(Consts.AssemblySystem_Windows_Forms);
+ if (wfAsm == null)
+ return DialogResult.None;
+
+ Type buttons = wfAsm.GetType
("System.Windows.Forms.MessageBoxButtons");
+ messageBoxButtonsAbortRetryIgnore = Enum.Parse
(buttons, "AbortRetryIgnore");
+ msgboxShow = wfAsm.GetType
("System.Windows.Forms.MessageBox").GetMethod (
+ "Show",
+ new Type [] {typeof (string), typeof
(string), buttons});
+ } catch {
+ return DialogResult.None;
+ }
+
+ if (msgboxShow == null ||
messageBoxButtonsAbortRetryIgnore == null)
+ return DialogResult.None;
+
string caption = String.Format ("Assertion Failed: {0}
to quit, {1} to debug, {2} to continue", "Abort", "Retry", "Ignore");
string msg = String.Format ("{0}{1}{2}{1}{1}{3}",
message, Environment.NewLine, detailMessage, new StackTrace ());
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches