[Mono-bugs] [Bug 74901][Nor] New - System.Timers.Timer doesn't work properly when using the SynchronizingObject property

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 10 May 2005 16:21:23 -0400 (EDT)


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 sebastien@ximian.com.

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

--- shadow/74901	2005-05-10 16:21:23.000000000 -0400
+++ shadow/74901.tmp.18584	2005-05-10 16:21:23.000000000 -0400
@@ -0,0 +1,119 @@
+Bug#: 74901
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sebastien@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Timers.Timer doesn't work properly when using the SynchronizingObject property
+
+Description of Problem:
+System.Timers.Timer doesn't work properly when using the
+SynchronizingObject property.
+
+
+Steps to reproduce the problem:
+1. Compile the following sample code using
+   mcs stt.cs /r:System.Windows.Forms.dll
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Timers;
+using System.Windows.Forms;
+
+class Program {
+
+	static void ShowStackTrace (object o, ElapsedEventArgs e)
+	{
+		Console.WriteLine (counter);
+		if (counter++ > 5) {
+			t.AutoReset = false;
+			t.Enabled = false;
+		}
+	}
+
+	static System.Timers.Timer t;
+	static int counter = 0;
+
+	static void Main (string[] args)
+	{
+		bool so = (args.Length > 0);
+		Label label = new Label ();
+
+		t = new System.Timers.Timer (500);
+		if (so)
+			t.SynchronizingObject = label;
+		t.Elapsed += new ElapsedEventHandler (ShowStackTrace);
+		t.AutoReset = true;
+		t.Enabled = true;
+		
+		System.Threading.Thread.Sleep (5000);
+	}
+}
+
+
+
+2. Execute the compiled assembly without parameters
+
+   mono stt.exe
+
+3. Execute the compiled assembly with a "x" parameter
+
+   mono stt.exe x
+
+
+Actual Results (Mono):
+
+% mono stt.exe
+0
+1
+2
+3
+4
+5
+6
+
+% mono stt.exe x
+
+[... nothing happens ... nothing returns ...]
+
+
+Expected Results (MS):
+
+% mono stt.exe
+0
+1
+2
+3
+4
+5
+6
+
+% mono stt.exe x
+0
+1
+2
+3
+4
+5
+6
+
+
+How often does this happen? 
+Always
+
+
+Additional Information:
+Some debugging code inside corlib shows that AsyncResult are being
+allocated at each interval. However the callback isn't executed.