Skip to content

Instantly share code, notes, and snippets.

@czmoss
Last active May 22, 2019 22:29
Show Gist options
  • Save czmoss/11b426fc94757f5c4ed6776fb6480f2e to your computer and use it in GitHub Desktop.
Save czmoss/11b426fc94757f5c4ed6776fb6480f2e to your computer and use it in GitHub Desktop.
async delegates execute ouside exception handlers
using System;
class ActionInLimbo {
public static void Main() {
Action frob_s = () => {
throw new Exception(nameof(frob_s));
};
Action frob_a = async () => {
throw new Exception(nameof(frob_a));
};
try {
frob_s.Invoke();
} catch (Exception e) {
Console.Error.WriteLine(e.ToString());
}
try {
frob_a.Invoke();
} catch (Exception e) {
Console.Error.WriteLine(e.ToString());
}
// Give frob_a enough time to execute
System.Threading.Thread.Sleep(2000);
// Watch the world burn.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment