This project is read-only.

R.NET stealing CancelKeyPress

Jun 30, 2014 at 11:09 AM
            Boolean breakit = false;
            Console.CancelKeyPress += (sender, eventArgs) =>
            {
                breakit = true;
            };
            REngine re = REngine.GetInstance(device: new ConsoleDevice());
            
            while (true)
            {
                Thread.Sleep(100);
                if (breakit) break;
            }

            Console.WriteLine("finished");
The registered method does not work if REngine is initialized after subscribing it. It works if the order is reversed though (first initialising REngine, then subscribing to the event)
Jun 30, 2014 at 1:31 PM
Thank you for reporting this. This is probably something that interplays with the native R engine, which probably catches Esc key presses. While I know a bit about events in .NET, I have no first hand know how on what the native R engine is doing. I'll open an issues, at least to flag the need to document the behavior.