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 🙂



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!