jbevain / cecil

Cecil is a library to inspect, modify and create .NET programs and libraries.
MIT License
2.73k stars 624 forks source link

Removed MaxStackSize setter. #892

Open kekyo opened 1 year ago

kekyo commented 1 year ago

When generating assemblies using cecil, I manually specified .maxstack for MethodBody, but it is not reflected. It is always overwritten with the calculated result. This problem has been fixed in this PR.

Example:

var method = new MethodDefinition(...);
var body = method.Body;

body.MaxStackSize = 100;

// ...

module.Write("foo.dll");
kekyo commented 1 year ago

I wasn't sure if the setter for the MaxStackSize property should check to see if the value has been changed, but I determined that the intention was to change it when the setter was called. How about this?