[X++] CIL Generation Error .NET Cast Type Name not found
Sometimes you create a new custom service or any other class and the CIL compilation will throw an error similar to the following:
CIL generation: Error: .NET Cast Type Name not found. Type System.String found on the stack. This code in Class/Table: [ClassName], Method: [MethodName] may not work in CIL run time.
To resolve this error, change the RunOn
property on your class to Server
and run the CIL generation. After it ran successful, you can change the property back to CalledFrom
and further builds should succeed.
I found my solution on this discussion:
https://community.dynamics.com/ax/f/33/t/80777