Closed kevinjwz closed 3 years ago
Thanks for the bug report!
Due to the way the IL is generated by the compiler, InlineIL should have emitted an error on Push(b.int32)
, but the current validator didn't catch the issue.
I pushed a v1.7.0-pre1 package to NuGet that fixes this, in the sense that an error will now be emitted for your code.
Since the new validator can emit errors for code that happened to work fine in previous versions, I added a IL.EnsureLocal
method which should be useful in simpler cases, but it won't help for ref var
unfortunately. IL.Push
wasn't a great idea anyway.
.NET SDK version: 5.0.202 InlineIL.Fody version: 1.6.0 Command line options: dotnet build -c Release
Example:
Add
compiles to:Notice there are 2
ldfld
instructions at 000E and 0013.