Hello,
I started 7 days ago to port my DLL ,to comunicate to a external webservice, to NAV 2013.
With the NAV objects I had no problems, except that in 2009, my C# dll with automation was involved but in NAV 2013 server it does not work anymore.
CREATE(Automation,TRUE,FALSE)
This dont works anymore in NAV 2013.
Alright, so I run the automation on the client side.
Problem is now, it loads with File.open (test.xml) an XML to a stream, but since the automation on the client side he can not be passed to the Three Tier Server.
The solution: DotNet
DotNet can be running on the server, but now I need to customize my dll in C#
but i get this error:
Microsoft Dynamics NAV
---------------------------
This message is for C / AL programmers:. A NET variable has not been instantiated. Attempting 'asp.Test.RequestFileNameAddon' in 'codeunit test management interface' call: requestHitList
---------------------------
OK
---------------------------
my interface is a dll that contains 1 main class, 20 subclasses (with 20-40 methods) and 20 interface of the subclasses
with the the automation, i was able to use the DLL esayli with the 20 interfaces to access each of them. The main class includes methods that are used by all classes.
How can i create an interface for integration into NAV DotNet? What should I do with it in C# to instantiated it?
I hope you understand what my problem is. and my pretty bad english.
Leo
Comments
It's similar to the create(automation) function, however, you have to call it yourself
So you don't have to change your C# dll, it is .net from the beginnning, the automation exposure is the backwards compatiblity.
I just had the delight of having a similar task, where the dll would be both automation and .net (to support classic and rtc).
With registration of regasm (for automation) and gacutil (for .net)
so this should do it:
|To-Increase|
i dont know what should missing? i have the dll in the gobla assambly cache.
the code of the dll:
it is first to test it, but it still dont work maybe i have to do anything in the code what i am missing.
So you just extended the com? and that's all. Do you have a small example I can compile and try out?
For more information about how you can use the interoperability feature, you can take a look at http://msdn.microsoft.com/en-us/library/gg502499.aspx or some of the related blogs on Mibuso.
Notice that the constructor call is somewhat different from the CREATE call on the legacy automation type. The constructor must be used in an assignment like this:
myVar := myVar.MyType();
assuming that the variable myVar is defined as an instance of the MyType .Net type.
If you ignore the assignment you will create an instance of your type, but if will not be assigned to the variable and the application code will fail. You don't have to call the constructor if you use a static class or if you only want to access static members in a class.
Hint: Development and debug of .Net componets should be done an a sandboxed server that you can start and stop as needed. As soon as you have loaded one version of your assembly you cannot replace it before the server has been restarted as the OS will lock the file while it's loaded. It can be easier to manage if you don't gac you r assembly but instead distribute it to the Add-ins folder for the development environment (C/Side), the client (if client side interoperability is needed) and the server.
Niels-Henrik Sejthen
Senior Software Developer
Microsoft Dynamics NAV
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
If we don's see the NAV code, we can't help you.
Your .net class is simple enough, so it must be on how you call this dll.
Mberger, here is a small example
I check with ISSERVICETIER if I have to create the automation or the dotnet variable both referencing to the same dll.
And thank you for your insights nhsejth
|To-Increase|
Would you be kind and post the full code ?
I am struggling with the report "Export Instrastat to XML", the problem is the fact that automation is no longer used/supported in NAV2013 R2, so somehow I have to fix the report to compile and run again.
Any specific suggestions please?
Thank you in advance.