continue;
}
+ bool foundAttribute = false, foundIteratorAttribute = false;
foreach (StateMachineAttribute asma in attributes)
{
if (asma.StateMachineType == declaringType)
{
- method = candidateMethod;
- declaringType = candidateMethod.DeclaringType;
- // Mark the iterator as changed; so it gets the + annotation of the original method
- // async statemachines resolve directly to their builder methods so aren't marked as changed
- return asma is IteratorStateMachineAttribute;
+ foundAttribute = true;
+ foundIteratorAttribute |= asma is IteratorStateMachineAttribute;
}
}
+
+ if (foundAttribute)
+ {
+ // If this is an iterator (sync or async), mark the iterator as changed, so it gets the + annotation
+ // of the original method. Non-iterator async state machines resolve directly to their builder methods
+ // so aren't marked as changed.
+ method = candidateMethod;
+ declaringType = candidateMethod.DeclaringType;
+ return foundIteratorAttribute;
+ }
}
return false;
/// <summary>Gets the result of the operation.</summary>
/// <param name="token">Opaque value that was provided to the <see cref="ValueTask"/>'s constructor.</param>
+ [StackTraceHidden]
public TResult GetResult(short token)
{
ValidateToken(token);
internal static class ManualResetValueTaskSourceCoreShared // separated out of generic to avoid unnecessary duplication
{
+ [StackTraceHidden]
internal static void ThrowInvalidOperationException() => throw new InvalidOperationException();
internal static readonly Action<object> s_sentinel = CompletionSentinel;