kekyo / IL2C

IL2C - A translator for ECMA-335 CIL/MSIL to C language.
Apache License 2.0
401 stars 36 forks source link

Add supporting ILVerify on building process. #111

Closed kekyo closed 2 years ago

kekyo commented 2 years ago

Related #100

Some regression test cases (<30) are failed with similar message:

  Failed Int64ToUInt32(12345678) [955 ms]
  Error Message:
   System.InvalidProgramException : Invalid IL code in IL2C.ILConverters.Box_Narrowing:Box_Int64ToUInt32 (long): IL_0001: box       0x01000019

  Stack Trace:
    at IL2C.ILConverters.Box_Narrowing.Int64ToUInt32 (System.Int64 value) [0x00001] in <388a0caad905431c8bad8b9c06952e63>:0 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0007c] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 

InvalidProgramException causes containing absolutely invalid IL sequence in the assembly. So we have to check manually composed IL code.