static void Main(string[] args)
{
var program = new Program();
var tokenSource = new CancellationTokenSource();
Console.CancelKeyPress += (sender, eventArgs) =>
{
// NOTE: This cancelling logic does not work in the VS2010 debugger with .Net 4, but does fine otherwise
tokenSource.Cancel();
eventArgs.Cancel = true;
};
program.Run(tokenSource.Token, Console.WriteLine);
}