{
#if !ES_BUILD_PCL
msg = msg.TrimEnd('\r', '\n') +
- string.Format(CultureInfo.InvariantCulture, ", Thrd({0})" + Environment.NewLine, Thread.CurrentThread.ManagedThreadId);
+ string.Format(CultureInfo.InvariantCulture, ", Thrd({0})" + Environment.NewLine, Environment.CurrentManagedThreadId);
System.Diagnostics.Debugger.Log(0, null, msg);
#endif
}
/// <summary>Provides an awaiter for a <see cref="ConfiguredValueTaskAwaitable"/>.</summary>
[StructLayout(LayoutKind.Auto)]
- public readonly struct ConfiguredValueTaskAwaiter : ICriticalNotifyCompletion
-#if CORECLR
- , IStateMachineBoxAwareAwaiter
-#endif
+ public readonly struct ConfiguredValueTaskAwaiter : ICriticalNotifyCompletion, IStateMachineBoxAwareAwaiter
{
/// <summary>The value being awaited.</summary>
private readonly ValueTask _value;
}
}
-#if CORECLR
void IStateMachineBoxAwareAwaiter.AwaitUnsafeOnCompleted(IAsyncStateMachineBox box)
{
object obj = _value._obj;
TaskAwaiter.UnsafeOnCompletedInternal(Task.CompletedTask, box, _value._continueOnCapturedContext);
}
}
-#endif
}
}
/// <summary>Provides an awaiter for a <see cref="ConfiguredValueTaskAwaitable{TResult}"/>.</summary>
[StructLayout(LayoutKind.Auto)]
- public readonly struct ConfiguredValueTaskAwaiter : ICriticalNotifyCompletion
-#if CORECLR
- , IStateMachineBoxAwareAwaiter
-#endif
+ public readonly struct ConfiguredValueTaskAwaiter : ICriticalNotifyCompletion, IStateMachineBoxAwareAwaiter
{
/// <summary>The value being awaited.</summary>
private readonly ValueTask<TResult> _value;
}
}
-#if CORECLR
void IStateMachineBoxAwareAwaiter.AwaitUnsafeOnCompleted(IAsyncStateMachineBox box)
{
object obj = _value._obj;
TaskAwaiter.UnsafeOnCompletedInternal(Task.CompletedTask, box, _value._continueOnCapturedContext);
}
}
-#endif
}
}
}
task.SetContinuationForAwait(continuation, continueOnCapturedContext, flowExecutionContext);
}
-#if CORECLR
/// <summary>Schedules the continuation onto the <see cref="System.Threading.Tasks.Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
/// <param name="task">The task being awaited.</param>
/// <param name="stateMachineBox">The box to invoke when the await operation completes.</param>
// If TaskWait* ETW events are enabled, trace a beginning event for this await
// and set up an ending event to be traced when the asynchronous await completes.
- if (TplEtwProvider.Log.IsEnabled() || Task.s_asyncDebuggingEnabled)
+ if (
+#if CORECLR
+ TplEtwProvider.Log.IsEnabled() || Task.s_asyncDebuggingEnabled
+#else
+ TaskTrace.Enabled
+#endif
+ )
{
task.SetContinuationForAwait(OutputWaitEtwEvents(task, stateMachineBox.MoveNextAction), continueOnCapturedContext, flowExecutionContext: false);
}
task.UnsafeSetContinuationForAwait(stateMachineBox, continueOnCapturedContext);
}
}
-#endif
+
/// <summary>
/// Outputs a WaitBegin ETW event, and augments the continuation action to output a WaitEnd ETW event.
/// </summary>
namespace System.Runtime.CompilerServices
{
/// <summary>Provides an awaiter for a <see cref="ValueTask"/>.</summary>
- public readonly struct ValueTaskAwaiter : ICriticalNotifyCompletion
-#if CORECLR
- , IStateMachineBoxAwareAwaiter
-#endif
+ public readonly struct ValueTaskAwaiter : ICriticalNotifyCompletion, IStateMachineBoxAwareAwaiter
{
/// <summary>Shim used to invoke an <see cref="Action"/> passed as the state argument to a <see cref="Action{Object}"/>.</summary>
internal static readonly Action<object> s_invokeActionDelegate = state =>
}
}
-#if CORECLR
void IStateMachineBoxAwareAwaiter.AwaitUnsafeOnCompleted(IAsyncStateMachineBox box)
{
object obj = _value._obj;
TaskAwaiter.UnsafeOnCompletedInternal(Task.CompletedTask, box, continueOnCapturedContext: true);
}
}
-#endif
}
/// <summary>Provides an awaiter for a <see cref="ValueTask{TResult}"/>.</summary>
- public readonly struct ValueTaskAwaiter<TResult> : ICriticalNotifyCompletion
-#if CORECLR
- , IStateMachineBoxAwareAwaiter
-#endif
+ public readonly struct ValueTaskAwaiter<TResult> : ICriticalNotifyCompletion, IStateMachineBoxAwareAwaiter
{
/// <summary>The value being awaited.</summary>
private readonly ValueTask<TResult> _value;
}
}
-#if CORECLR
void IStateMachineBoxAwareAwaiter.AwaitUnsafeOnCompleted(IAsyncStateMachineBox box)
{
object obj = _value._obj;
TaskAwaiter.UnsafeOnCompletedInternal(Task.CompletedTask, box, continueOnCapturedContext: true);
}
}
-#endif
}
-#if CORECLR
/// <summary>Internal interface used to enable optimizations from <see cref="AsyncTaskMethodBuilder"/>.</summary>>
internal interface IStateMachineBoxAwareAwaiter
{
/// <param name="box">The box object.</param>
void AwaitUnsafeOnCompleted(IAsyncStateMachineBox box);
}
-#endif
}
/// <summary>Provides an awaiter that switches into a target environment.</summary>
/// <remarks>This type is intended for compiler use only.</remarks>
- public readonly struct YieldAwaiter : ICriticalNotifyCompletion
-#if CORECLR
- , IStateMachineBoxAwareAwaiter
-#endif
+ public readonly struct YieldAwaiter : ICriticalNotifyCompletion, IStateMachineBoxAwareAwaiter
{
/// <summary>Gets whether a yield is not required.</summary>
/// <remarks>This property is intended for compiler user rather than use directly in code.</remarks>
}
}
-#if CORECLR
void IStateMachineBoxAwareAwaiter.AwaitUnsafeOnCompleted(IAsyncStateMachineBox box)
{
Debug.Assert(box != null);
}
}
}
-#endif
private static Action OutputCorrelationEtwEvent(Action continuation)
{