web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Cannot create an instance of the following .Net framework - Custom DLL - NAV2017

(0) ShareShare
ReportReport
Posted on by
Hello Nav community

I got the following problem:
For a interface to an document management system we need some custom .NET DLL's. But for all theese Dll's I get an runtime error:
NAVDllError.PNG
In NAV2009R2 we used the same interface and used the DLL's via Automation/Com Interface which worked fine. In NAV2017 we would like to use the dot net classes directly.
I Copied the folders with the requierd DLL's to C:\Program Files\Microsoft Dynamics NAV\100\Service\Add-ins on the dynamics nav Service Tier.
In the development enviroment I created a DotNet variable and then I selected my DLL from the Server Tab in the assemlbies. This worked fine and I can also see all the methods and properties of the classes in both the client and the server, so the DLL is found.

But when I execute the code I always get this error:

This error message I got for both Dll's I tried, one is a PDF Creator DLL for .net from 
https://www.pdf-tools.com/pdf20/de/home/ and the other is from the document management system.
The error I got with RunOnClient=Yes and also for RunOnClient=No
When debugging the error already pops up at the line where I try to initialize the variable in C/AL: NewPDFAPIL := NewPDFAPIL.Secure; So it is not a error in a function, already in the initzializing.

I already tried following things and could not solve the problem:
  • I installed the DLL directly on the Client in the Addin Folder
  • I cleared the temporary cache on both the client and the server with the microsoft dynamics nav addin folder.
  • I gave full control rights to users on the folder that contains the dll
  • I tried different versions of the product/dll

I am thankful for any help or suggestions

Best Regards
Joshua
 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    If the DLL is in the addin folder of the client, RunOnClient must be YES. If it's placed in the add-in folder of the service tier, RunOnClient must be set to FALSE.

    Have you ried to re-add the reference after placing the dll in the addin folder?

  • Community Member Profile Picture
    on at

    Hello Stefano

    Thanks for the answer, yes I know the difference between RunOnclient Yes and No and tired both scenarios and both did give the error.

    I also re added the reference multiple times and also restarted the nav service.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Very strange then. Is this an addin that requires a particular setup for installing it?

  • Community Member Profile Picture
    on at

    No it does not, it is just a normal DLL with some Functions in it that we need. I also do really not know what to do anymore.

    Here is a link to the dll https://1drv.ms/u/s!Ar5DM52h81oYgcQ8vbygQ1x0RDDKww

  • Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    Have you tired to registrer the DLL and then access it as an automation variable instead of an DotNet variable?

    It could be that the DLL is too old to be used directly as an DotNet variable.

  • Travis Ashby Profile Picture
    5 on at

    Hello,

    I encountered this error this morning,

    It ended up being that the Microsoft.Dynamics.Nav.Server.exe.config file was no longer a CONFIG file rather just a text file on the server.

    I replaced the text file with a working CONFIG file and cleared my local NAV cache by going to

    %TEMP%\Microsoft Dynamics NAV\Add-Ins and deleting the folder.

    re opened NAV and I was able to use all Ad-Hoc reports on the connection.

    Hope this helps someone in the future.

  • kub4nek Profile Picture
    10 on at

    Hi,

    I've been facing the same issue since NAV 2018 (now in BC14) but only in some environments (which is Citrix based; if that matters).

    But anyways: a workaround would be to copy the DLL into Service parent folder of the Add-Ins folder.

    HTH,

    JC

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans