Пример #1
0
        /// <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);
        }
Пример #2
0
        public static AsyncVoidMethodBuilder Create()
        {
            var asyncVoidMethodBuilder = new AsyncVoidMethodBuilder();

            asyncVoidMethodBuilder.SynchContext = SynchronizationContext.Current;
            return(asyncVoidMethodBuilder);
        }
Пример #3
0
 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
            {
            }
        }
Пример #6
0
        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);
        }
Пример #7
0
 public static AsyncVoidMethodBuilder Create() => LastInstance = new AsyncVoidMethodBuilder();