void WriteStateMachineHoistedLocalScopes(PdbStateMachineHoistedLocalScopesCustomDebugInfo cdi) { if (!methodContext.HasBody) { helper.Error("Method has no body, can't write custom debug info: " + cdi.Kind); return; } foreach (var scope in cdi.Scopes) { uint startOffset, endOffset; if (scope.IsSynthesizedLocal) { startOffset = 0; endOffset = 0; } else { var startInstr = scope.Start; if (startInstr == null) { helper.Error("Instruction is null"); return; } startOffset = methodContext.GetOffset(startInstr); endOffset = methodContext.GetOffset(scope.End); } if (startOffset > endOffset) { helper.Error("End instruction is before start instruction"); return; } writer.Write(startOffset); writer.Write(endOffset - startOffset); } }
void WriteStateMachineHoistedLocalScopes(PdbStateMachineHoistedLocalScopesCustomDebugInfo cdi) { if (!methodContext.HasBody) { helper.Error2("Method has no body, can't write custom debug info: {0}.", cdi.Kind); return; } var cdiScopes = cdi.Scopes; int count = cdiScopes.Count; for (int i = 0; i < count; i++) { var scope = cdiScopes[i]; uint startOffset, endOffset; if (scope.IsSynthesizedLocal) { startOffset = 0; endOffset = 0; } else { var startInstr = scope.Start; if (startInstr is null) { helper.Error("Instruction is null"); return; } startOffset = methodContext.GetOffset(startInstr); endOffset = methodContext.GetOffset(scope.End); } if (startOffset > endOffset) { helper.Error("End instruction is before start instruction"); return; } writer.WriteUInt32(startOffset); writer.WriteUInt32(endOffset - startOffset); } }