/// <summary> /// Creates an instance of the <see cref="T:System.Runtime.CompilerServices.AsyncVoidMethodBuilder" /> class. /// </summary> /// <returns> /// A new instance of the builder. /// </returns> public static AsyncVoidMethodBuilder Create() { var result = new AsyncVoidMethodBuilder(); result.m_coreState = new AsyncMethodBuilderCore(); return(result); }
public static AsyncVoidMethodBuilder Create() { var asyncVoidMethodBuilder = new AsyncVoidMethodBuilder(); asyncVoidMethodBuilder.SynchContext = SynchronizationContext.Current; return(asyncVoidMethodBuilder); }
static AsyncVoidMethodBuilder() { try { AsyncVoidMethodBuilder.PreventUnobservedTaskExceptions(); } catch { } }
private TaskCompletionSource<TResult> _taskCompletionSource; // lazily-initialized: must not be readonly static AsyncTaskMethodBuilder() { try { // Temporary support for disabling crashing if tasks go unobserved. AsyncVoidMethodBuilder.PreventUnobservedTaskExceptions(); } catch { } }
/// <summary>Temporary support for disabling crashing if tasks go unobserved.</summary> static AsyncTaskMethodBuilder() { _defaultResultTask = AsyncMethodTaskCache <TResult> .CreateCompleted(default(TResult)); try { AsyncVoidMethodBuilder.PreventUnobservedTaskExceptions(); } catch { } }
public static AsyncVoidMethodBuilder Create() { SynchronizationContext sc = SynchronizationContext.Current; if (sc != null) { sc.OperationStarted(); } // On ProjectN we will eagerly initalize the task and it's Id if the debugger is attached AsyncVoidMethodBuilder avmb = new AsyncVoidMethodBuilder() { m_synchronizationContext = sc }; avmb.m_task = avmb.GetTaskIfDebuggingEnabled(); if (avmb.m_task != null) { int i = avmb.m_task.Id; } return(avmb); }
public static AsyncVoidMethodBuilder Create() => LastInstance = new AsyncVoidMethodBuilder();