> Correct me if I'm wrong, but 'method' is internal (not private) and > ParameterDefinitionCollection seems to writes to it in the > ParameterDefinitionCollection.OnXY() functions... > > Simon
Ahh... OK thank you for pointing that out Simon. I *think* I see what's happening now. If we look at: https://github.com/jbevain/cecil/blob/master/Mono.Cecil.Cil/MethodBody.cs#L98 We can see: public ParameterDefinition ThisParameter { get { if (method == null || method.DeclaringType == null) throw new NotSupportedException (); return this_parameter ?? (this_parameter = new ParameterDefinition ("0", ParameterAttributes.None, method.DeclaringType)); } } ... shouldn't this instead be something like ... public ParameterDefinition ThisParameter { get { if (method == null || method.DeclaringType == null) throw new NotSupportedException (); if(this_parameter == null) { this_parameter = new ParameterDefinition ("0", ParameterAttributes.None, method.DeclaringType) this_parameter.method = this.Method } return this_parameter; } } ... to make sure method gets set for this params? Thanks -Keith -- keithsheppard.name -- -- mono-cecil
