[Mono-bugs] [Bug 74902][Wis] New - System.Windows.Forms.Timer needs some events to trigger

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 10 May 2005 16:27:33 -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=74902

--- shadow/74902	2005-05-10 16:27:33.000000000 -0400
+++ shadow/74902.tmp.18623	2005-05-10 16:27:33.000000000 -0400
@@ -0,0 +1,105 @@
+Bug#: 74902
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sebastien@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Windows.Forms.Timer needs some events to trigger
+
+Description of Problem:
+System.Windows.Forms.Timer needs some other events to trigger.
+
+
+Steps to reproduce the problem:
+1. Compile this sample code
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Windows.Forms;
+
+class Program {
+
+	static void ShowStackTrace (object o, EventArgs e)
+	{
+		if (debug)
+			Console.WriteLine ("{0}: {1}", counter, Environment.StackTrace);
+
+		try {
+			Console.WriteLine (Assembly.GetExecutingAssembly ().Evidence.Count);
+			result = 1;
+		}
+		catch (SecurityException se) {
+			if (debug)
+				Console.WriteLine ("EXPECTED SecurityException {0}", se);
+		}
+		catch (Exception ex) {
+			Console.WriteLine ("UNEXPECTED {0}", ex);
+		}
+
+		counter++;
+	}
+
+	static bool debug;
+	static int counter;
+	static int result = 0;
+
+	// this Deny will prevent the Assembly.Evidence property from working
+	[SecurityPermission (SecurityAction.Deny, ControlEvidence = true)]
+	static int Main (string[] args)
+	{
+		debug = (args.Length > 0);
+		if (debug) {
+			SecurityManager.SecurityEnabled = (args [0] != "off");
+		}
+
+		if (SecurityManager.SecurityEnabled) {
+			Console.WriteLine ("SecurityManager.SecurityEnabled: true");
+			ShowStackTrace (null, null);
+		} else {
+			Console.WriteLine ("SecurityManager.SecurityEnabled: false");
+		}
+
+		Timer t = new Timer ();
+		t.Tick += new EventHandler (ShowStackTrace);
+		t.Interval = 1000;
+		t.Start ();
+		
+		while (counter <= 5)
+			Application.DoEvents ();
+
+		return result;
+	}
+}
+
+
+2. Execute the sample with a "x" parameter
+
+% mono sample.exe x
+
+
+Actual Results:
+No output is displayed.
+
+
+Expected Results:
+ShowStackTrace should output every second.
+
+
+How often does this happen? 
+Always if you don't move the mouse (or probably other X events).
+
+
+Additional Information:
+* This seems to be like the Control.BeginInvoke polling bug