Refactoring with AI

AI has rapidly transformed how I do my job, and there’s no going back. Even if models suddenly become much more expensive, we’ll think more carefully about how we use them, we may limit AI to fairly routine tasks and so on, but no one will return to doing everything manually. The question is how …

Continue reading ‘Refactoring with AI’ »

Running X++ tests through SysTestConsole

I ran into several problems when trying to run unit tests from command line in cloud-hosted environments (for 10.0.48 and 10.0.49; I don’t know how it looks like in other versions). I normally don’t run tests from command line; I run them either from Visual Studio, or DevOps pipelines to do it for me. But …

Continue reading ‘Running X++ tests through SysTestConsole’ »

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: …

Continue reading ‘InvalidProgramException in D365 F&O’ »

Extensions of final methods

Let’s assume that D365 F&O comes with the following class and we want to extend its showInfo() method: class Demo { public static void main(Args _args) { new Demo().showInfo(); }   public final void showInfo() { info("Base"); }   } Let’s try the usual approach, Chain of Command: [ExtensionOf(classStr(Demo))] internal final class Demo_Extension { public …

Continue reading ‘Extensions of final methods’ »

ID assignment in composite entity

When importing a composite entity with headers and lines to D365 F&O, you can let the system assign IDs and apply them to both headers and lines. For example, I can import the following file with sales order data: <?xml version="1.0" encoding="utf-8"?> <Document> <SALESORDERHEADERV3ENTITY> <ORDERINGCUSTOMERACCOUNTNUMBER>CustA</ORDERINGCUSTOMERACCOUNTNUMBER> <SALESORDERLINEV2ENTITY> <ITEMNUMBER>ItemA</ITEMNUMBER> <ORDEREDSALESQUANTITY>1</ORDEREDSALESQUANTITY> </SALESORDERLINEV2ENTITY> <SALESORDERLINEV2ENTITY> <ITEMNUMBER>ItemB</ITEMNUMBER> <ORDEREDSALESQUANTITY>2</ORDEREDSALESQUANTITY> </SALESORDERLINEV2ENTITY> </SALESORDERHEADERV3ENTITY> <SALESORDERHEADERV3ENTITY> …

Continue reading ‘ID assignment in composite entity’ »