Exemplo n.º 1
0
        RawAsyncStepInfo[] ISymbolMethod2.GetAsyncStepInfos()
        {
            Debug.Assert(IsAsyncMethod);
            var data = Root.GetSymAttribute(asyncMethodInfoAttributeName);

            if (data == null)
            {
                throw new InvalidOperationException();
            }
            int pos   = 8;
            int count = BitConverter.ToInt32(data, pos);

            pos += 4;
            if (pos + (long)count * 12 > data.Length)
            {
                return(emptyRawAsyncStepInfo);
            }
            if (count == 0)
            {
                return(emptyRawAsyncStepInfo);
            }
            var res = new RawAsyncStepInfo[count];

            for (int i = 0; i < res.Length; i++)
            {
                res[i] = new RawAsyncStepInfo(BitConverter.ToUInt32(data, pos), BitConverter.ToUInt32(data, pos + 8), BitConverter.ToUInt32(data, pos + 4));
                pos   += 12;
            }
            return(res);
        }
Exemplo n.º 2
0
        public RawAsyncStepInfo[] GetAsyncStepInfos()
        {
            Debug.Assert(IsAsyncMethod);
            if (asyncMethod == null)
            {
                throw new InvalidOperationException();
            }
            var stepInfoCount     = asyncMethod.GetAsyncStepInfoCount();
            var yieldOffsets      = new uint[stepInfoCount];
            var breakpointOffsets = new uint[stepInfoCount];
            var breakpointMethods = new uint[stepInfoCount];

            asyncMethod.GetAsyncStepInfo(stepInfoCount, out stepInfoCount, yieldOffsets, breakpointOffsets, breakpointMethods);
            var res = new RawAsyncStepInfo[stepInfoCount];

            for (int i = 0; i < res.Length; i++)
            {
                res[i] = new RawAsyncStepInfo(yieldOffsets[i], breakpointOffsets[i], breakpointMethods[i]);
            }
            return(res);
        }