Home

Util.Cleanup doesn't seem to be getting executed

I can't seem to get the Util.Cleanup event to fire. Here is the query I am running to test with:

async Task Main() {
    var cts = new CancellationTokenSource();
    Util.Cleanup += (_, _) => {
        MessageBox.Show("Query cancelled.");
        "Query cancelled.".Dump();
        cts.Cancel();
    };

    while (!cts.IsCancellationRequested) {
        await Task.Delay(100, cts.Token);
    }
}

Comments

Sign In or Register to comment.