Development, Dynamics NAV

Dynamics NAV 2018 and VS Code – Debugging Error, sorry that didn’t work

So you have downloaded and installed the shiny new version of Microsoft Dynamics NAV, fired up VS Code to create your first extension, run it, but then when the WebClient opens you are greeted with the blue screen and a ‘Sorry that didn’t work’ message…

Fortunately there is a quick fix, navigate to the C:\Program Files\Microsoft Dynamics NAV\110\Service folder, and edit the Microsoft.Dynamics.Nav.Server.exe.config file (you need to edit it with Administrator rights), find and remove the following line;

<NetFx40_LegacySecurityPolicy enabled=”true”/>

Restart the NST and viola 🙂


Azure AD

Adding email alias when using Azure AD Connect

So we have an on-premise AD running, this is connected to my Office 365 (and therefore Azure AD) using the Azure AD Connect. Great.

My only problem so far has been when I needed to add an alias email, normally I would simply log onto the Office 365 Admin Portal, go to my user click edit under the username/email section and add the Alias in there, however after connecting up the AD Connect it now shows;


So how to get around this, it must be done in the On Premise AD, but initially it isn’t obvious.

First, log onto your local AD, then go to Active Directory Users & Computers MMC. From there, click the View along the top and enable Advanced Features.


Now close the MMC and go back in, find your user and go into the properties, you should now see a new tab called Attribute Editor. In there you will find an attribute called proxyAddresses. This is what we need.

You need to add all the addresses you want in here; prefixed with smtp:

Your primary address should start with SMTP: (yes uppercase!), all the others should be lowercase.

Once added let AD Sync and viola! It works.


Dynamics N.A.V and Homogenous AppDomain Error

What an earth I hear you ask.. well that’s what I thought too.


So I have doing some development, basically I have an incoming Json feed from a Shopify Web-hook, my initial thought was to create a C# Object which I could reference as a DotNet variable in Dynamics N.A.V. the using Newtonsoft deserialize into this object.. easy.. and to be honest it was…

Until that is I got sent a request from Shopify that had an unexpected reference. Originally when I built the object class I used the samples provided by Shopify, turns out though that the sample doesn’t contain everything, so the first time a shipment notification came through that contained an order with a refund…. bam! It broke.

My original object didn’t have a Refunds section, so when I tried to deserialize it, well it didn’t know what to do.

So… I thought I would simply use a dynamic objectthen just map info I actually needed, ignoring what I didn’t, then pass this back into Dynamics N.A.V.

I added an overloaded constructor to my c# class which now looked like;

/// Ctor +1
/// </summary>
/// <param name="jsonText"></param>
public FulfillmentNotice (string jsonText)
    dynamic t = JsonConvert.DeserializeObject<dynamic>(jsonText);

    id =;
    order_number = t.order_number;
    billing_address = t.billing_address.ToObject<Address>();
    shipping_address = t.shipping_address.ToObject<Address>();

    payment_gateway_names = new List<string>();
    foreach (string s in t.payment_gateway_names)

    // init list
    shipping_lines = new List<Shipping_Lines>();
    foreach (dynamic shipline in t.shipping_lines)

    // init list
    fulfillments = new List<Fulfillment>();
    foreach (dynamic fulLine in t.fulfillments)

    // init list
    discount_codes = new List<Discount_Codes>();
    foreach (dynamic disLine in t.discount_codes)


So now I call the new constructor passing in the Json text, worked nicely, now it completely ignores anything unexpected, great!

Next I altered my codeunit within Dynamics N.A.V. to use the new code, complied then ran the function, unfortunately I got..

A call to ShopifyFulfillmentReceiver.Library.FulfillmentNotice failed with this message: Dynamic operations can only be performed in homogenous AppDomain.

Well I wasn’t really expecting that, though I thought I had seen it before.

The Solution

So what do you need to do? You need to remove/change the following file in the Microsoft.Dynamics.Nav.Server.exe.config file. Find the section <runtime> and you should see a line <NetFx40_LegacySecurityPolicy enabled=”false”/> and change it to false, restart the NST and it should work –  if the section exist, put the below withing the <configuration> section

<NetFx40_LegacySecurityPolicy enabled="false"/>

As always, you should check it on a dev instance before rolling out to a live instance, making sure it doesn’t affect anything!