Hi JB,

I have added a complete new method to an existing class.

VariableDefinition loc0 = new
VariableDefinition(ModuleDefinition.Import(typeof(StateManager)));
VariableDefinition loc1 = new
VariableDefinition(ModuleDefinition.Import(typeof(int)));
md.Body.Variables.Add(loc0);
md.Body.Variables.Add(loc1);
md.Body.InitLocals = true;

ILProcessor p = md.Body.GetILProcessor();
p.Append(p.Create(OpCodes.Ldfld,
ModuleDefinition.Import(stateManager));
p.Append(p.Create(OpCodes.Stloc_0);
...

If I switch off the pdb writer the generated code is correct but i am
not able to write the pdb file. Everything is fine for new methods
without variables.

Jan

-- 
--
mono-cecil

Reply via email to