vendredi 26 mai 2023

System.InvalidProgramException Common Language Runtime detected an invalid program for Reflection

System.InvalidProgramException : Common Language Runtime detected an invalid program. Seeing this error message whilst trying to check the expression's correctness and if it is the correct IL.

The expression is "DateTimeA.GetType().Name", where we expect the result to be a string i.e. "String;DateTimeA.GetType().Name;String".

This is an example from "ValidExpressions.txt" using mparlak's "Flee" (see https://github.com/mparlak/Flee/blob/master/src/Flee/).

For some reason, the code is failing on that specific expression. I've checked what the emitted ops are and it goes as follows...

ldarg.0
ldfld
callvirt
callvirt
ret

length 17

I've run the test on the Flee library (as the .txt file was in the tests but the test was previously removed), and it fails with this error. Not entirely sure how to resolve it... I expect this test to pass with no problems but it appears that the "GetType()" method specifically is causing problems and I'm not sure why...





Aucun commentaire:

Enregistrer un commentaire