Sdílet prostřednictvím


Enc APIs aren't exposed through reflection

David  Srbecky asked:

Can a EnC capable compiler work on top of System.Refletion.Emit? (ie. If an existing compiler is to be extended to support EnC, does it have to be rewritten to use the unmanaged emitting interface?)

Unfortuantely, No. Details:
1. You can indeed write a compiler in C# which emits using reflection-emit (here's a sample for v1.1).
2. However, the Edit-and-Continue functionality in the unmanaged metadata APIs is not exposed via Reflection-emit. You could create your own metadata wrappers that expose this functionality, but there are dangers directly using the metadata APIs from managed code.
3. On a related note, you can't use EnC to edit Dynamic code (code generated by ref-emit).

Comments

  • Anonymous
    May 08, 2006
    Thank you very much for your quick reply!