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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Using a DOTNET variable working ok client side but is giving me an error when i run it server side

(0) ShareShare
ReportReport
Posted on by 1,191 Moderator

I have written a .net assembly compiled as an DLL that i want to use in Dynamics NAV 2017.  My DLL has events so i want to run it in a codeunit and have the "Run on client" property to false so i can have the "WithEvents" property set to false.

I have copied the DLL file to the Add-ins folder both for the service and for the client.

In my codeunit i call the constructor as this:

myDll: = myDll.Constructior;

myDll.myMethode();

When i run the codeunit i get an error saying:"Object reference not set to an instance of an object".

But when i change the "Run on client" property to yes and set the "WithEvents" to false - the codeunit is executing with out error. 

Normally i am used to getting this error when the DLL is not present in the Add-ins folder for the service but this is not the case in this situation.

Can anyone help me explaine why the codeunit cause an runtime error when i run it server side and not when i run it client side and how i should fix this ?

*This post is locked for comments

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

    Yes, you're right. If RunOnClient = No the DLL is executed at server side and must be present in add-in folder of the service tier.

    If client and server has the same DLL deployed in the same way, it's strange that RunOnClient = yes works and RunOnClient = false does not. Maybe you have dependencies from other assembly?

  • IB-29041624-0 Profile Picture
    1,191 Moderator on at

    There are dependencies to another assembly but that assembly is also present in the server tier add-ins folder.

    I could ofcourse be tricked if there is an assembly in another sub folder to the add-ins folder on the client side that is used when running client side.  I will try it on a fresh installation to see if i get the same problem there.

  • IB-29041624-0 Profile Picture
    1,191 Moderator on at

    I tried the same thing on another installation running the same build of Microsoft Dynamics NAV 2017. And there i am able to run my code without error even when the DOTNET variable is set to run on server. So i guess the problem must be caused by some condition on the machine i am doing my development on. But have still not be able to figure out what it is.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans