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