[Mono-bugs] [Bug 79127][Min] New - SWF Timer should not work when started from another thread

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Aug 20 22:37:50 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by scottell.lists at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79127

--- shadow/79127	2006-08-20 22:37:50.000000000 -0400
+++ shadow/79127.tmp.10791	2006-08-20 22:37:50.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 79127
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: scottell.lists at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: SWF Timer should not work when started from another thread
+
+This is kind of a minor issue, but I'll log it anyway:  On MS.NET, when you
+try to start a System.Windows.Forms.Timer from a thread other than the
+main, nothing happens.  The Tick event does not occur.  However, Mono's
+SWF.Timer implementation does work from another thread.  For consistency's
+sake it probably should not.
+
+Here is a simple test app for your convenience:
+
+
+using System;
+using System.Threading;
+using System.Windows.Forms;
+
+public class T : Form 
+{
+	System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();
+	
+	public static int Main (string[] args) 
+	{
+		Application.Run(new T());
+		return 0;
+	}
+
+	public T () 
+	{
+		Label l = new Label ( );
+		l.Text = "click me";
+		l.Click += Clicky;
+		l.Dock = DockStyle.Fill;
+		Controls.Add ( l );
+
+		myTimer.Interval = 500;		
+		myTimer.Tick += TickHandler;
+	}
+
+	void Clicky ( object o, EventArgs e)
+	{
+		Thread thread = new Thread ( new ThreadStart ( StartThread ) );
+		thread.Start();
+	}
+
+	void StartThread ()
+	{
+		Thread.Sleep ( 1000 );
+		myTimer.Start ();
+	}
+
+	void TickHandler ( object o, EventArgs e )
+	{
+		Console.WriteLine ( "Should not occur" );
+	}
+}


More information about the mono-bugs mailing list