Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
chrislemm
Partner - Contributor III
Partner - Contributor III

System.Core Error when calling .NET SDK Functions from Dynamics NAV

Hello,

we started building a little library to get the version-no. from our qlik sense server. We wrote it into a dll because we want to connect Microsoft Dynamics NAV and Qlik Sense Server. As far I know you can call .NET-Libs from NAV (tested and it's working) but for some reason, I don't get, we can't call our connector-DLL, here's the code:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

/// <QlikSenseSDK>

using Qlik.Engine;

using Qlik.Engine.Extensions;

using Qlik.Sense;

using Qlik.Sense.Client;

using Qlik.Sense.Client.Visualizations;

/// </QlikSenseSDK>

namespace net2qlik

{

    public class Net2QlikConnector

    {

        string myHost = "http://ourserver.ourdomain.ourtld";

        ILocation myLocation;

        public string Initialize()

        {

            try

            {

                Uri absolutURI = new Uri(myHost);

                myLocation = Qlik.Engine.Location.FromUri(absolutURI);

                myLocation.AsNtlmUserViaProxy(false); //<- this function might cause the crash

                string tempServerVersionNo = myLocation.Hub().ProductVersion();

                return tempServerVersionNo;

            }

            catch (Exception e)

            {

                return e.ToString();

            }

        }

    }

asd}

We commented out every line -> AsNtlmUserViaProxy or Autofac.dll might cause these crashes, or do you have a suggestion how to work around?

When we call this library in MS Dynamics NAV 2016 or 2017 we get an error that some file is not found which includes the system.core data from the .NET-Framework:

errorsnav.PNG

Which would be the following in english:

Error calling net2qlik.Net2QlikConnector.Initialize with the following message:

Could not find file or assembly "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" or one of its dependencies.

Problem here is that we're using .NET Framework v4.5.1+ (as in the documentation recommended) but autofac or the dlls included by this functions throws us errors from old framework versions. We, f.e., have a System.Core.dll which is Version 4.0.0.0 so we can't find the error.

The DLL is x86 Visual Studio compiled only static references to the qlik-api which I included using the nuget-manager.

I can call the dll from a different .NET-App which works as I expected only Dynamics NAV causes me this troubles.


Does anyone know what to do or what I've been doing wrong?

Best greetings

6 Replies
konrad_mattheis
Luminary Alumni
Luminary Alumni

Hi Chirstoher,

try to contact Prisma Informatik, they have written a Navision Qlik Integration and they are using the .NET SDK, so I believe they can answer this easily.

bye Konrad

chrislemm
Partner - Contributor III
Partner - Contributor III
Author

Well yes I could. But for example I don't know if they will help me building a simple connector between qlik and nav when they sell this kind of product.

I  hope we have someone here facing the same problems as I do.

Not applicable

Hi Christopher,

copy the mscorlib.dll (version 2.0.50727.8009), System.Core.dll (version 2.0.3.0523.6) and System.dll (version 2.0.3.0523.6) in

               %TEMP%\Microsoft Dynamics NAV\Add-Ins.

This will solve your problem, since the dlls will be loaded by Dynamics NAV in the assembly cache.

Best regards

René

chrislemm
Partner - Contributor III
Partner - Contributor III
Author

We already tried this multiple times without an working result. We changed DLLs we've added them we replaced them with old ones etc.

What we didn't try was replacing mscorlib, system.core AND system.dll but we've troubles finding the System.Core.dll  in version 2.0.3.0523.6 and a System.dll in version 2.0.3.0523.6.

chrislemm
Partner - Contributor III
Partner - Contributor III
Author

Having the same errors as before

Not applicable

Hello,

did you find a solution to your problem ?