Tuesday 12 March 2024

How to fix Error: "Common Language Runtime detected an invalid program" in D365FO

Recently, we upgraded our environment, which resulted in one of our customizations, previously working flawlessly, throwing the "Common Language Runtime detected an invalid program" error. During the debugging process, we identified a piece of code, to be the root cause of the error.

Error Screenshot:

Code Snippet Causing The Error:

Error Fix: To resolve this issue, I stored the result of DateTime::Now in a variable and then accessed the Ticks property from that variable. This approach eliminated the error, and the code now functions properly as it did before.

I understand the fix may seem unusual and nonsensical to some, but regardless, it worked. 😊

No comments:

Post a Comment

Key Updates in Dynamics 365 F&O for Version 10.0.39

Here’s a concise summary of the  platform updates  in  Microsoft Dynamics 365 Finance & Operations version 10.0.39 (March 2024) : 1- Add...