Skip to content

Instantly share code, notes, and snippets.

@jmarolf
Last active November 21, 2018 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmarolf/82b0974a4bce86e007af143af57628eb to your computer and use it in GitHub Desktop.
Save jmarolf/82b0974a4bce86e007af143af57628eb to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
public static class Program
{
[StructLayout(LayoutKind.Auto)]
[CompilerGenerated]
private struct <Boom>d__1 : IAsyncStateMachine
{
public int <>1__state;
public AsyncVoidMethodBuilder <>t__builder;
private void MoveNext()
{
try
{
throw new Exception("Boom!");
}
catch (Exception exception)
{
<>1__state = -2;
<>t__builder.SetException(exception);
}
}
void IAsyncStateMachine.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
this.MoveNext();
}
[DebuggerHidden]
private void SetStateMachine(IAsyncStateMachine stateMachine)
{
<>t__builder.SetStateMachine(stateMachine);
}
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
{
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
this.SetStateMachine(stateMachine);
}
}
private static void Go()
{
Boom();
}
[AsyncStateMachine(typeof(<Boom>d__1))]
private static void Boom()
{
<Boom>d__1 stateMachine = default(<Boom>d__1);
stateMachine.<>t__builder = AsyncVoidMethodBuilder.Create();
stateMachine.<>1__state = -1;
AsyncVoidMethodBuilder <>t__builder = stateMachine.<>t__builder;
<>t__builder.Start(ref stateMachine);
}
}
using System;
public static class Program {
static void Go(){
Boom();
}
static async void Boom(){
throw new Exception("Boom!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment