Thanks for the advice! I understand you wouldn't want to add something that would clutter up the API for rare cases like this.
On Dec 21, 7:24 am, Jb Evain <[email protected]> wrote: > Hi, > > On Tue, Dec 21, 2010 at 2:50 PM, Contra <[email protected]> wrote: > > I'm curious how cecil manages invalid OpCodes. Taking a look through > > cecil I see no handling of invalid opcodes, so where should I start? > > So far I've made a few edits to Code (just added an Invalid type), > > OpCodes, and OpCode. Specifically I'm referring to invalid opcodes > > from babel and other similar obfuscators. > > Indeed, there's no handling of invalid opcodes. And I don't have any > interest in supporting them, API wise. Cecil is made to > read/manipulate and write ecma CIL images, and if I don't mind > avoiding a crash to support some weird constructs emitted by > obfuscators, I mind adding API surface just for the sake of them. > > Now that the rant part if over, if you want to implement support for > it, you'll have to deal with reading them in the > Mono.Cecil.Cil.CodeReader, and possible to write them in the > Mono.Cecil.Cil.CodeWriter if you want to write them. > > The instructions are read per opcode, so you'll have to add some code > here to deal with the case where the opcode is unknown. > > Jb -- -- mono-cecil
