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

User [EMAIL PROTECTED] added comment
https://bugzilla.novell.com/show_bug.cgi?id=430483#c2





--- Comment #2 from Steve Odbc <[EMAIL PROTECTED]>  2008-09-29 07:50:50 MDT ---
Created an attachment (id=242258)
 --> (https://bugzilla.novell.com/attachment.cgi?id=242258)
code that triggers invalid op exception

I mean the System.Windows.Forms.Timer and the method is just called "Tick"
(sorry for that, it used to be called OnTimer in VB years ago). Yes, marshal it
to the gui thread, since I'm convinced MS does the same (but I didn't check
their code).

And also yes, I wanted to state that MONO does not always check the thread. But
that is not a serious bug, since you can workaround with discipline (as long as
the Timer doesn't contradict). In MS you also need to pay attention to this,
since you don't catch those InvalidOperationException, but you avoid them from
the start.

The clue is, you need Application.Run() for those exceptions to work.
Application.Run() (with or without parameter - it does not matter) registers
the calling thread as the main thread. And from that moment on the
InvalidOperationException is thrown nearly always. I don't think you can just
add this functionality to each field, property and method, you rather need a
more general approach that kind of automatically does it for you.

Check my attachment to trigger exceptions.


-- 
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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to