ltrzesniewski / InlineIL.Fody

Inject arbitrary IL code at compile time.
MIT License
240 stars 17 forks source link

nop after any Il #17

Closed LadislavSopko closed 4 years ago

LadislavSopko commented 4 years ago

Hello nice extension! I just saw it add nop after any instruction, is it wanted?

thx

ltrzesniewski commented 4 years ago

Hello,

These nops are added by Roslyn between statements when you compile in Debug mode. They are not there when you compile in Release mode.

InlineIL removes nops which cause generated code to be incorrect, like the ones between a prefix instruction and its target, but will leave the others as they cause no trouble, and may even be useful for debugging.

Anyway I thought about removing the nops between emitted instructions as they can be confusing and harm readability in Debug mode, but I'm still not sure if I should do it or not. 😉

ltrzesniewski commented 4 years ago

I removed the additional nop instructions that were left after each emitted instruction in Debug builds in v1.4.1.

You will still see some other nop instructions, like the one emitted for the { opening brace of the method which lets you put a breakpoint there. I left these to keep the expected debugger features working.