InvalidProgramException in D365 F&O
I run into two cases when F&O threw InvalidProgramException at runtime. This is the full message: System.InvalidProgramException: Common Language Runtime detected an invalid program. It happened because X++ compiler generated invalid IL that the JIT compiler wasn’t able to compile to native code. One scenario is assigning a struct to an interface-types variable. For example: …