New CUs are out, get’em while they’re hot :)

It’s that time of the month, a new batch of Microsoft Dynamics NAV cumulative updates are out, here are the direct link for downloads

CU8 for NAV2017 https://www.microsoft.com/en-us/download/details.aspx?id=55581

CU21 for NAV2016 https://www.microsoft.com/en-us/download/details.aspx?id=55579

CU33 for NAV2015 https://www.microsoft.com/en-us/download/details.aspx?id=55578

CU45 for NAV2013R2 https://www.microsoft.com/en-us/download/details.aspx?id=55580

CU52 for NAV2013 https://www.microsoft.com/en-us/download/details.aspx?id=55582

Create Instance of DotNet variables – the hard way!

Have you ever seen this error:

Assignment is not allowed for this variable? But it’s just a DotNet class that I’m trying to make an instance of. (The class in my example is DocumentFormat.OpenXml.Spreadsheet.Text that is used for adding strings to Excel sheets).

But this is Applied Hacking, so we can use reflection to get around this. Here is “DotNetConstructor”, simplified to a version where the constructor takes just one parameter

The idea is simple, get the ConstructorInfo and Invoke it. To do that, you need a DotNet Array first with the Types of parameters and then antoher array with the parameter values. This function can easily be extended to handle multiple parameters.

So instead of using:

Text := Text.Text('Value');

We can just do:

DotNetConstructor(Text,'Value',Text);

Enjoy 🙂