Ejemplo n.º 1
0
        private static EXCEPTION_INFO[] GetExceptionsFromEnumerator(int enumHResult, IEnumDebugExceptionInfo2 enumerator)
        {
            if (enumHResult == VSConstants.S_FALSE)
            {
                return(new EXCEPTION_INFO[0]);
            }

            if (enumHResult != VSConstants.S_OK)
            {
                Marshal.ThrowExceptionForHR(enumHResult);
            }

            uint count;
            var  hr = enumerator.GetCount(out count);

            if (hr != VSConstants.S_OK)
            {
                Marshal.ThrowExceptionForHR(hr);
            }

            if (count == 0)
            {
                return(new EXCEPTION_INFO[0]);
            }

            var buffer       = new EXCEPTION_INFO[count];
            var countFetched = 0U;

            hr = enumerator.Next(count, buffer, ref countFetched);
            if (hr != VSConstants.S_OK)
            {
                Marshal.ThrowExceptionForHR(hr);
            }

            return(buffer);
        }
        private static EXCEPTION_INFO[] GetExceptionsFromEnumerator(int enumHResult, IEnumDebugExceptionInfo2 enumerator) {
            if (enumHResult == VSConstants.S_FALSE)
                return new EXCEPTION_INFO[0];

            if (enumHResult != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(enumHResult);

            uint count;
            var hr = enumerator.GetCount(out count);
            if (hr != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(hr);

            if (count == 0)
                return new EXCEPTION_INFO[0];

            var buffer = new EXCEPTION_INFO[count];
            var countFetched = 0U;
            hr = enumerator.Next(count, buffer, ref countFetched);
            if (hr != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(hr);

            return buffer;
        }