internal static void SerializeCustomDebugInformation(ref CustomDebugInfoEncoder encoder, EditAndContinueMethodDebugInformation debugInfo) { // PERF: note that we pass debugInfo as explicit parameter // that is intentional to avoid capturing debugInfo as that // would result in a lot of delegate allocations here that are otherwise can be avoided. if (!debugInfo.LocalSlots.IsDefaultOrEmpty) { encoder.AddRecord( CustomDebugInfoKind.EditAndContinueLocalSlotMap, debugInfo, (info, builder) => info.SerializeLocalSlots(builder)); } if (!debugInfo.Lambdas.IsDefaultOrEmpty) { encoder.AddRecord( CustomDebugInfoKind.EditAndContinueLambdaMap, debugInfo, (info, builder) => info.SerializeLambdaMap(builder)); } if (!debugInfo.StateMachineStates.IsDefaultOrEmpty) { encoder.AddRecord( CustomDebugInfoKind.EditAndContinueStateMachineStateMap, debugInfo, (info, builder) => info.SerializeStateMachineStates(builder)); } }
private static void SerializeTupleElementNames(ref CustomDebugInfoEncoder encoder, IMethodBody methodBody) { var locals = GetLocalInfoToSerialize( methodBody, local => !local.TupleElementNames.IsEmpty, (scope, local) => (local, scope)); if (locals == null) { return; } encoder.AddRecord(CustomDebugInfoKind.TupleElementNames, locals, SerializeTupleElementNames); locals.Free(); }