5 Replies Latest reply: Jan 5, 2017 1:55 AM by Christopher Lemm RSS

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

    Christopher Lemm

      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