Announcements
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 ?
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.
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.
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?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,246 Super User 2024 Season 2
Martin Dráb 228,041 Super User 2024 Season 2
nmaenpaa 101,148