[Mono-bugs] [Bug 430477] Debug.Assert() does not work in winform apps

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Sep 30 03:52:50 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=430477

User awunwpa7 at yahoo.com.ph added comment
https://bugzilla.novell.com/show_bug.cgi?id=430477#c8





--- Comment #8 from Steve Odbc <awunwpa7 at yahoo.com.ph>  2008-09-30 01:52:49 MDT ---
While testing the MONO DefaultTraceListener class I found two things I would
change:

Don't just abort the thread, since it raises a ThreadAbortException in MONO to
abort the main thread. So quit the process. The comment on bug #317040 is wrong
here, since MS seems to kill a ui application if the user clicks Abort. Maybe
console applications work different.

Replace (in Fail):

if (ProcessUI (message, detailMessage) == DialogResult.Abort)
    Thread.CurrentThread.Abort ();
WriteLine (new StackTrace().ToString());

With:

if (ProcessUI (message, detailMessage) == DialogResult.Abort)
    Environment.Exit (0);
WriteLine (new StackTrace().ToString());


And skip the recent seven stack trace items, as they are of no interest:

Replace (in ProcessUI):

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 ());

With:

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 (7));



-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list