void AddLocals(MethodDef method, IList <Local> locals, uint startOffset, uint endOffset) { if (locals.Count == 0) { return; } uint token = metaData.GetLocalVarSigToken(method); if (token == 0) { Error("Method {0} ({1:X8}) has no local signature token", method, method.MDToken.Raw); return; } foreach (var local in locals) { if (local.Name == null && local.PdbAttributes == 0) { continue; } writer.DefineLocalVariable2(local.Name ?? string.Empty, (uint)local.PdbAttributes, token, 1, (uint)local.Index, 0, 0, startOffset, endOffset); } }