Lokad / ILPack

Serialize .NET Core assemblies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail to deserialize: volatile field reference

dmiller opened this issue · comments

Given

class A 
{ 
   volatile int _vfield; 
}

C# will generate for a._vfield the IL

    IL_0008: volatile.
    IL_000a: ldfld int32 modreq([netstandard]System.Runtime.CompilerServices.IsVolatile) VolatileTest.VolClass::_vfield

ILPack generates:

    IL_0007: ldfld int32 [VolatileTest]VolatileTest.VolClass::_vfield

(You can explicitly add the volatile. instruction -- doesn't matter.)

On load, this fails with a "Field not found" exception.

PR #160 contains all the equired changes for fixing this problem.