public static IEnumerable <AsyncStepInfo> GetAsyncStepInfos(this ISymUnmanagedAsyncMethod asyncMethod) { uint count; int hr = asyncMethod.GetAsyncStepInfoCount(out count); ThrowExceptionForHR(hr); if (count == 0) { yield break; } var yieldOffsets = new uint[count]; var breakpointOffsets = new uint[count]; var breakpointMethods = new uint[count]; hr = asyncMethod.GetAsyncStepInfo(count, out count, yieldOffsets, breakpointOffsets, breakpointMethods); ThrowExceptionForHR(hr); ValidateItems((int)count, yieldOffsets.Length); ValidateItems((int)count, breakpointOffsets.Length); ValidateItems((int)count, breakpointMethods.Length); for (int i = 0; i < count; i++) { yield return(new AsyncStepInfo((int)yieldOffsets[i], (int)breakpointOffsets[i], (int)breakpointMethods[i])); } }
public static IEnumerable <SymUnmanagedAsyncStepInfo> GetAsyncStepInfos(this ISymUnmanagedAsyncMethod method) { if (method == null) { throw new ArgumentNullException(nameof(method)); } int count; ThrowExceptionForHR(method.GetAsyncStepInfoCount(out count)); if (count == 0) { yield break; } var yieldOffsets = new int[count]; var breakpointOffsets = new int[count]; var breakpointMethods = new int[count]; ThrowExceptionForHR(method.GetAsyncStepInfo(count, out count, yieldOffsets, breakpointOffsets, breakpointMethods)); ValidateItems(count, yieldOffsets.Length); ValidateItems(count, breakpointOffsets.Length); ValidateItems(count, breakpointMethods.Length); for (int i = 0; i < count; i++) { yield return(new SymUnmanagedAsyncStepInfo(yieldOffsets[i], breakpointOffsets[i], breakpointMethods[i])); } }
public static int GetKickoffMethod(this ISymUnmanagedAsyncMethod asyncMethod) { uint result; int hr = asyncMethod.GetKickoffMethod(out result); ThrowExceptionForHR(hr); return((int)result); }
public static int GetKickoffMethod(this ISymUnmanagedAsyncMethod method) { if (method == null) { throw new ArgumentNullException(nameof(method)); } int result; ThrowExceptionForHR(method.GetKickoffMethod(out result)); return(result); }
public static int GetCatchHandlerILOffset(this ISymUnmanagedAsyncMethod asyncMethod) { bool hasCatchHandler; int hr = asyncMethod.HasCatchHandlerILOffset(out hasCatchHandler); ThrowExceptionForHR(hr); if (!hasCatchHandler) { return(-1); } uint result; hr = asyncMethod.GetCatchHandlerILOffset(out result); ThrowExceptionForHR(hr); return((int)result); }
public static int GetCatchHandlerILOffset(this ISymUnmanagedAsyncMethod method) { if (method == null) { throw new ArgumentNullException(nameof(method)); } bool hasCatchHandler; ThrowExceptionForHR(method.HasCatchHandlerILOffset(out hasCatchHandler)); if (!hasCatchHandler) { return(-1); } int result; ThrowExceptionForHR(method.GetCatchHandlerILOffset(out result)); return(result); }
private static BlobHandle SerializeAsyncMethodSteppingInfo(MetadataBuilder metadataBuilder, ISymUnmanagedAsyncMethod symAsyncMethod, int moveNextMethodRowId) { var builder = new BlobBuilder(); builder.WriteUInt32((uint)((long)symAsyncMethod.GetCatchHandlerILOffset() + 1)); foreach (var stepInfo in symAsyncMethod.GetAsyncStepInfos()) { builder.WriteInt32(stepInfo.YieldOffset); builder.WriteInt32(stepInfo.ResumeOffset); builder.WriteCompressedInteger(moveNextMethodRowId); } return(metadataBuilder.GetOrAddBlob(builder)); }
public SymbolMethodImpl(SymbolReaderImpl reader, ISymUnmanagedMethod method) { this.reader = reader; this.method = method; asyncMethod = method as ISymUnmanagedAsyncMethod; }
public SymbolMethod(ISymUnmanagedMethod method) { this.method = method; this.asyncMethod = method as ISymUnmanagedAsyncMethod; }
internal SymAsyncMethod(SymReader reader, ISymUnmanagedAsyncMethod method) { _reader = reader; _method = method; }
private void WriteAsyncInfo(ISymUnmanagedAsyncMethod asyncMethod) { _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(); }