Beispiel #1
0
        private void WriteAsyncInfo(ISymUnmanagedMethod method)
        {
            var asyncMethod = method.AsAsync();

            if (asyncMethod == null)
            {
                return;
            }

            writer.WriteStartElement("asyncInfo");

            var catchOffset = asyncMethod.GetCatchHandlerILOffset();

            if (catchOffset >= 0)
            {
                writer.WriteStartElement("catchHandler");
                writer.WriteAttributeString("offset", AsILOffset(catchOffset));
                writer.WriteEndElement();
            }

            writer.WriteStartElement("kickoffMethod");
            WriteMethodAttributes(asyncMethod.GetKickoffMethod(), isReference: true);
            writer.WriteEndElement();

            foreach (var info in asyncMethod.GetAsyncStepInfos())
            {
                writer.WriteStartElement("await");
                writer.WriteAttributeString("yield", AsILOffset(info.YieldOffset));
                writer.WriteAttributeString("resume", AsILOffset(info.ResumeOffset));
                WriteMethodAttributes(info.ResumeMethod, isReference: true);
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
Beispiel #2
0
        private void WriteAsyncInfo(ISymUnmanagedMethod method)
        {
            var asyncMethod = method.AsAsync();
            if (asyncMethod == null)
            {
                return;
            }

            _writer.WriteStartElement("asyncInfo");

            var catchOffset = asyncMethod.GetCatchHandlerILOffset();
            if (catchOffset >= 0)
            {
                _writer.WriteStartElement("catchHandler");
                _writer.WriteAttributeString("offset", AsILOffset(catchOffset));
                _writer.WriteEndElement();
            }

            _writer.WriteStartElement("kickoffMethod");
            WriteMethodAttributes(asyncMethod.GetKickoffMethod(), isReference: true);
            _writer.WriteEndElement();

            foreach (var info in asyncMethod.GetAsyncStepInfos())
            {
                _writer.WriteStartElement("await");
                _writer.WriteAttributeString("yield", AsILOffset(info.YieldOffset));
                _writer.WriteAttributeString("resume", AsILOffset(info.ResumeOffset));
                WriteMethodAttributes(info.ResumeMethod, isReference: true);
                _writer.WriteEndElement();
            }

            _writer.WriteEndElement();
        }