Created
July 13, 2023 19:27
-
-
Save fredrikhr/14ff035d0a0dec97365a6d992b47dfd9 to your computer and use it in GitHub Desktop.
This file contains 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; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Net; | |
using System.Net.Sockets; | |
public class C { | |
public ValueTask<int> ReceiveFromAsync( | |
Memory<byte> buffer, | |
SocketFlags socketFlags, | |
ref SocketAddress socketAddress, | |
CancellationToken cancellationToken = default | |
) | |
{ | |
throw new NotImplementedException(); | |
} | |
public async Task M() { | |
SocketAddress? address = default; | |
while (true) { | |
var r = await ReceiveFromAsync(Memory<byte>.Empty, default, ref address!); | |
await Task.Delay(1000); | |
} | |
} | |
} |
This file contains 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; | |
using System.Diagnostics; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Security; | |
using System.Security.Permissions; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.CodeAnalysis; | |
[assembly: CompilationRelaxations(8)] | |
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] | |
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue | DebuggableAttribute.DebuggingModes.DisableOptimizations)] | |
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] | |
[assembly: AssemblyVersion("0.0.0.0")] | |
[module: UnverifiableCode] | |
[module: System.Runtime.CompilerServices.RefSafetyRules(11)] | |
public class C | |
{ | |
[CompilerGenerated] | |
private sealed class <M>d__1 : IAsyncStateMachine | |
{ | |
public int <>1__state; | |
public AsyncTaskMethodBuilder <>t__builder; | |
public C <>4__this; | |
private SocketAddress <address>5__1; | |
private int <r>5__2; | |
private int <>s__3; | |
private ValueTaskAwaiter<int> <>u__1; | |
private TaskAwaiter <>u__2; | |
private void MoveNext() | |
{ | |
int num = <>1__state; | |
try | |
{ | |
TaskAwaiter awaiter; | |
if (num != 0) | |
{ | |
if (num != 1) | |
{ | |
<address>5__1 = null; | |
goto IL_011c; | |
} | |
awaiter = <>u__2; | |
<>u__2 = default(TaskAwaiter); | |
num = (<>1__state = -1); | |
goto IL_0113; | |
} | |
ValueTaskAwaiter<int> awaiter2 = <>u__1; | |
<>u__1 = default(ValueTaskAwaiter<int>); | |
num = (<>1__state = -1); | |
goto IL_009d; | |
IL_009d: | |
<>s__3 = awaiter2.GetResult(); | |
<r>5__2 = <>s__3; | |
awaiter = Task.Delay(1000).GetAwaiter(); | |
if (awaiter.IsCompleted) | |
{ | |
goto IL_0113; | |
} | |
num = (<>1__state = 1); | |
<>u__2 = awaiter; | |
<M>d__1 stateMachine = this; | |
<>t__builder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine); | |
goto end_IL_0007; | |
IL_011c: | |
awaiter2 = <>4__this.ReceiveFromAsync(Memory<byte>.Empty, SocketFlags.None, ref <address>5__1).GetAwaiter(); | |
if (awaiter2.IsCompleted) | |
{ | |
goto IL_009d; | |
} | |
num = (<>1__state = 0); | |
<>u__1 = awaiter2; | |
stateMachine = this; | |
<>t__builder.AwaitUnsafeOnCompleted(ref awaiter2, ref stateMachine); | |
goto end_IL_0007; | |
IL_0113: | |
awaiter.GetResult(); | |
goto IL_011c; | |
end_IL_0007:; | |
} | |
catch (Exception exception) | |
{ | |
<>1__state = -2; | |
<address>5__1 = null; | |
<>t__builder.SetException(exception); | |
} | |
} | |
void IAsyncStateMachine.MoveNext() | |
{ | |
//ILSpy generated this explicit interface implementation from .override directive in MoveNext | |
this.MoveNext(); | |
} | |
[DebuggerHidden] | |
private void SetStateMachine([System.Runtime.CompilerServices.Nullable(1)] IAsyncStateMachine stateMachine) | |
{ | |
} | |
void IAsyncStateMachine.SetStateMachine([System.Runtime.CompilerServices.Nullable(1)] IAsyncStateMachine stateMachine) | |
{ | |
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine | |
this.SetStateMachine(stateMachine); | |
} | |
} | |
public ValueTask<int> ReceiveFromAsync(Memory<byte> buffer, SocketFlags socketFlags, [System.Runtime.CompilerServices.Nullable(1)] ref SocketAddress socketAddress, CancellationToken cancellationToken = default(CancellationToken)) | |
{ | |
throw new NotImplementedException(); | |
} | |
[System.Runtime.CompilerServices.NullableContext(1)] | |
[AsyncStateMachine(typeof(<M>d__1))] | |
[DebuggerStepThrough] | |
public Task M() | |
{ | |
<M>d__1 stateMachine = new <M>d__1(); | |
stateMachine.<>t__builder = AsyncTaskMethodBuilder.Create(); | |
stateMachine.<>4__this = this; | |
stateMachine.<>1__state = -1; | |
stateMachine.<>t__builder.Start(ref stateMachine); | |
return stateMachine.<>t__builder.Task; | |
} | |
} | |
namespace Microsoft.CodeAnalysis | |
{ | |
[CompilerGenerated] | |
[Embedded] | |
internal sealed class EmbeddedAttribute : Attribute | |
{ | |
} | |
} | |
namespace System.Runtime.CompilerServices | |
{ | |
[CompilerGenerated] | |
[Microsoft.CodeAnalysis.Embedded] | |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] | |
internal sealed class NullableAttribute : Attribute | |
{ | |
public readonly byte[] NullableFlags; | |
public NullableAttribute(byte P_0) | |
{ | |
byte[] array = new byte[1]; | |
array[0] = P_0; | |
NullableFlags = array; | |
} | |
public NullableAttribute(byte[] P_0) | |
{ | |
NullableFlags = P_0; | |
} | |
} | |
[CompilerGenerated] | |
[Microsoft.CodeAnalysis.Embedded] | |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] | |
internal sealed class NullableContextAttribute : Attribute | |
{ | |
public readonly byte Flag; | |
public NullableContextAttribute(byte P_0) | |
{ | |
Flag = P_0; | |
} | |
} | |
[CompilerGenerated] | |
[Microsoft.CodeAnalysis.Embedded] | |
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] | |
internal sealed class RefSafetyRulesAttribute : Attribute | |
{ | |
public readonly int Version; | |
public RefSafetyRulesAttribute(int P_0) | |
{ | |
Version = P_0; | |
} | |
} | |
} |
This file contains 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
{ | |
"version": 1, | |
"target": "C#", | |
"mode": "Debug" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment