Last active
May 22, 2019 22:29
-
-
Save czmoss/11b426fc94757f5c4ed6776fb6480f2e to your computer and use it in GitHub Desktop.
async delegates execute ouside exception handlers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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