예제 #1
0
        internal static void ThrowInvalidHandleException()
        {
            var ex = new InvalidOperationException(SR.InvalidOperation_InvalidHandle);

            ex.SetErrorCode(HResults.E_HANDLE);
            throw ex;
        }
예제 #2
0
        private static InvalidOperationException CreateCannotGetResultsFromIncompleteOperationException(Exception cause)
        {
            InvalidOperationException ex = (cause == null)
                            ? new InvalidOperationException(SR.InvalidOperation_CannotGetResultsFromIncompleteOperation)
                            : new InvalidOperationException(SR.InvalidOperation_CannotGetResultsFromIncompleteOperation, cause);

            ex.SetErrorCode(HResults.E_ILLEGAL_METHOD_CALL);
            return(ex);
        }
예제 #3
0
        internal void RemoveAtEnd <T>()
        {
            IList <T> objList = JitHelpers.UnsafeCast <IList <T> >((object)this);

            if (objList.Count == 0)
            {
                InvalidOperationException operationException = new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotRemoveLastFromEmptyCollection"));
                int hr = -2147483637;
                operationException.SetErrorCode(hr);
                throw operationException;
            }
            this.RemoveAt <T>((uint)objList.Count - 1U);
        }
        internal void RemoveAtEnd <T>()
        {
            IList <T> list = JitHelpers.UnsafeCast <IList <T> >(this);

            if (list.Count == 0)
            {
                Exception ex = new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotRemoveLastFromEmptyCollection"));
                ex.SetErrorCode(-2147483637);
                throw ex;
            }
            uint count = (uint)list.Count;

            this.RemoveAt <T>(count - 1U);
        }
        internal void RemoveAtEnd()
        {
            IList _this = JitHelpers.UnsafeCast <IList>(this);

            if (_this.Count == 0)
            {
                Exception e = new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotRemoveLastFromEmptyCollection"));
                e.SetErrorCode(__HResults.E_BOUNDS);
                throw e;
            }

            uint size = (uint)_this.Count;

            RemoveAt(size - 1);
        }
예제 #6
0
        // void RemoveAtEnd()
        internal void RemoveAtEnd <T>()
        {
            IList <T> _this = JitHelpers.UnsafeCast <IList <T> >(this);

            if (_this.Count == 0)
            {
                Exception e = new InvalidOperationException(SR.InvalidOperation_CannotRemoveLastFromEmptyCollection);
                e.SetErrorCode(HResults.E_BOUNDS);
                throw e;
            }

            uint size = (uint)_this.Count;

            RemoveAt <T>(size - 1);
        }
        // Token: 0x060062B1 RID: 25265 RVA: 0x0014FE78 File Offset: 0x0014E078
        internal ConstantSplittableMap(IMapView <TKey, TValue> data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (2147483647U < data.Size)
            {
                Exception ex = new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingDictionaryTooLarge"));
                ex.SetErrorCode(-2147483637);
                throw ex;
            }
            int size = (int)data.Size;

            this.firstItemIndex = 0;
            this.lastItemIndex  = size - 1;
            this.items          = this.CreateKeyValueArray(size, data.GetEnumerator());
        }
예제 #8
0
        internal ConstantSplittableMap(IMapView <TKey, TValue> data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if ((uint)int.MaxValue < data.Size)
            {
                InvalidOperationException operationException = new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingDictionaryTooLarge"));
                int hr = -2147483637;
                operationException.SetErrorCode(hr);
                throw operationException;
            }
            int count = (int)data.Size;

            this.firstItemIndex = 0;
            this.lastItemIndex  = count - 1;
            this.items          = this.CreateKeyValueArray(count, data.GetEnumerator());
        }
예제 #9
0
        internal ConstantSplittableMap(IMapView <TKey, TValue> data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            if (((UInt32)Int32.MaxValue) < data.Size)
            {
                Exception e = new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingDictionaryTooLarge"));
                e.SetErrorCode(__HResults.E_BOUNDS);
                throw e;
            }

            int size = (int)data.Size;

            this.firstItemIndex = 0;
            this.lastItemIndex  = size - 1;
            this.items          = CreateKeyValueArray(size, data.GetEnumerator());
        }
예제 #10
0
        /// <summary>Close the async info.</summary>
        public virtual void Close()
        {
            if (IsInClosedState)
            {
                return;
            }

            // Cannot Close from a non-terminal state:
            if (!IsInTerminalState)
            {
                // If we are STATE_NOT_INITIALIZED, the we probably threw from the ctor.
                // The finalizer will be called anyway and we need to free this partially constructed object correctly.
                // So we avoid throwing when we are in STATE_NOT_INITIALIZED.
                // In other words throw only if *some* async state is set:
                if (0 != (_state & STATEMASK_SELECT_ANY_ASYNC_STATE))
                {
                    InvalidOperationException ex = new InvalidOperationException(SR.InvalidOperation_IllegalStateChange);
                    ex.SetErrorCode(HResults.E_ILLEGAL_STATE_CHANGE);
                    throw ex;
                }
            }

            TransitionToClosed();
        }