[Mono-bugs] [Bug 82701][Nor] New - Setting System.Timers.Timer.Enabled to true doesn't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Sep 5 03:13:10 EDT 2007


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 publ at epf.pl.

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

--- shadow/82701	2007-09-05 03:13:10.000000000 -0400
+++ shadow/82701.tmp.10501	2007-09-05 03:13:10.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 82701
+Product: Mono: Class Libraries
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: Ubuntu 7.04
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: publ at epf.pl               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Setting System.Timers.Timer.Enabled to true doesn't work
+
+Description of Problem:
+
+I have a System.Timers.Timer with AutoReset property set to false. I want 
+to re-enable my timer in Elapsed event handler, so that after Elasped 
+execution timer should start its work again. Setting Enabled property to 
+true does nothing as much as using Start() method. 
+
+I also figured out that if instead of just setting Enabled to true i set 
+it to false and after that set to true - it seems working.
+
+Steps to reproduce the problem:
+
+1. compile attached test file: gmcs Timer.cs
+2. run Timer.exe 
+
+
+Actual Results:
+
+'Enabled: False'
+
+Expected Results:
+
+'Enabled: True' lines appearing until Enter key is pressed
+
+How often does this happen? 
+
+always
+
+Additional Information:
+
+---------- BEGIN Timer.cs FILE ------------
+
+using System.Timers;
+using System;
+namespace Test{
+	class Program{
+		public static void Main(string[] args){
+			Timer t = new Timer(200);
+			t.AutoReset = false;
+			t.Elapsed += Elapsed;
+			t.Start();
+			Console.ReadLine();
+		}
+		public static void Elapsed(Object sender, ElapsedEventArgs e){
+			Timer t = sender as Timer;
+			t.Enabled = true;
+			Console.WriteLine("Enabled: {0}", t.Enabled);
+		}
+	}
+}
+
+---------- END Timer.cs FILE ------------


More information about the mono-bugs mailing list