[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:25:27 EDT 2008


User awunwpa7 at yahoo.com.ph added comment

--- Comment #7 from Steve Odbc <awunwpa7 at yahoo.com.ph>  2008-09-30 01:25:26 MDT ---
Uhm, forget my code, since I looked into DefaultTraceListener.cs where
everything is available already. There is MessageBox code (including Robert's
idea of always using the main thread), but it does not work usually due to the
AssertUiEnabled flag, that by default seems to be off (is this the same
behaviour as MS?). If the default trace listener is added with this flag on,
things work in MONO.

Example code:

DefaultTraceListener d = new DefaultTraceListener();
d.AssertUiEnabled = true;

By the way: while I had a look at your code I found something that might be of
interest. There are some definitions in TraceListener.cs that use the
ThreadStatic attribute. As far as I know, ThreadStaticAttribute works only with
static fields, so your code won't work (there should be a compiler warning for
this issue):

        private int indentLevel = 0;

        private int indentSize = 4;

#if NET_2_0
        private StringDictionary attributes = new StringDictionary ();
        private TraceFilter filter;
        private TraceOptions options;


private static int indentLevel = 0;


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