Home > Mobile >  Unrecoverable IL error, but the IL looks fine
Unrecoverable IL error, but the IL looks fine

Time:09-26

I'm getting errors with the following IL. Any idea why? It looks fine to me!

enter image description here

The issue is with the lines stloc.4/ldloc.4 that are highlighted in bold.

The syntax highlighting is from Rider, but I get the same issue with ilasm as well.

I'm running this on MacOS.

CodePudding user response:

Problem is that there's no stloc.4, stloc.x goes up to 3. You should use stloc followed by number, e.g. stloc 4. Since index of variable is less than 255, it's possible to use stloc.s 4 to save few bytes in resulting assembly. Same applies to ldloc.4 at next line

  • Related