Beispiel #1
0
        public static bool IsEmpty(IAsyncLocalValueMap asyncLocalValueMap)
        {
            Debug.Assert(asyncLocalValueMap != null);
            Debug.Assert(asyncLocalValueMap == Empty || asyncLocalValueMap.GetType() != typeof(EmptyAsyncLocalValueMap));

            return(asyncLocalValueMap == Empty);
        }
Beispiel #2
0
        private ExecutionContext ShallowClone(bool isFlowSuppressed)
        {
            Debug.Assert(isFlowSuppressed != m_isFlowSuppressed);

            if (m_localValues == null ||
                m_localValues.GetType() == typeof(AsyncLocalValueMap.EmptyAsyncLocalValueMap))
            {
                return(isFlowSuppressed ?
                       DefaultFlowSuppressed :
                       null); // implies the default context
            }

            return(new ExecutionContext(m_localValues, m_localChangeNotifications, isFlowSuppressed));
        }
Beispiel #3
0
        private ExecutionContext ShallowClone(bool isFlowSuppressed)
        {
            Debug.Assert(isFlowSuppressed != m_isFlowSuppressed);

            if (!isFlowSuppressed &&
                (m_localValues == null ||
                 m_localValues.GetType() == typeof(AsyncLocalValueMap.EmptyAsyncLocalValueMap))
                )
            {
                return(null); // implies the default context
            }
            // Flow suppressing a Default context will have null values, set them to Empty
            return(new ExecutionContext(m_localValues ?? AsyncLocalValueMap.Empty, m_localChangeNotifications ?? Array.Empty <IAsyncLocal>(), isFlowSuppressed));
        }