PlugGen - Fill In Outputted Constant Field Values


Outputted constant values need to be assigned during output generation as the constants need to exactly match their counterparts from the plugged type. The AOT/JIT will not be able to map inverse plug overrides on these "fields" because constants are probably inlined when an assembly is compiled into IL.
This needs to be done right because it can cause major headaches.
Difficulty arises because Mono.Cecil loads constant data as a byte array (as represented in IL), which needs to be re-expressed as a CodeDOM primitive for the PlugGen emission process. Normal references to original constant values in the plugged assembly is not always possible due to the usage of constant fields as private/protected members.
Closed Aug 5, 2009 at 2:04 PM by illuminus86
No longer valid