[Mono-bugs] [Bug 80069][Wis] New - event isnt fired when CancelKey is pressed

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Nov 27 20:11:03 EST 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 alan.mcgovern at gmail.com.

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

--- shadow/80069	2006-11-27 20:11:03.000000000 -0500
+++ shadow/80069.tmp.1700	2006-11-27 20:11:03.000000000 -0500
@@ -0,0 +1,61 @@
+Bug#: 80069
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: tested in winxp
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: alan.mcgovern at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: event isnt fired when CancelKey is pressed
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+CancelKeyPress is never called when cancel key is sent to a console
+application.
+
+Steps to reproduce the problem:
+1. Compile the program below and run it
+2. Press Ctrl-C (the cancel key)
+
+Actual Results:
+The application exits immediately
+
+Expected Results:
+The applications prints "I hit the cancel key" then exits.
+
+
+How often does this happen? 
+Every time
+
+
+
+    class Program
+    {
+        private static bool exit = false;
+        static void Main()
+        {
+            Console.CancelKeyPress += new
+ConsoleCancelEventHandler(Console_CancelKeyPress);
+            while (!exit)
+            {
+                Console.WriteLine("Hit the cancel key to exit");
+                System.Threading.Thread.Sleep(1000);
+            }
+        }
+
+        static void Console_CancelKeyPress(object sender,
+ConsoleCancelEventArgs e)
+        {
+            Console.WriteLine("I hit the cancel key");
+            exit = true;
+        }
+    }


More information about the mono-bugs mailing list