Hello,
I try to use a .NET object in NAV but have a problem. With simple code, it works : I can instantiate a object, and call a method which gives back the string I gave to the constructor. But now I have a program in C# which communicates with MS Project. When I tried with a code that only connects and gives back the projects' list in a string I obtain an error message (see screenshots below). The program works when I use it in a .NET program.
I think it is caused by the genericity used by the
Load<> method. Is it right ?
Has someone any idea of a solution ?
Thanks
EDIT the error message was the wrong one I just updated the screen shot.
Answers
Thank you very much for your answer but same thing append even without the first line. I tried and I should have remove this line before doing a screenshot.
Thanks again
Also make a hello world function without parameter and string as return type, just to cut away noise. This should work.
What NAV version are you on?
Thanks for your help, I just realize trying this that I post the wrong message.
I obtain this message :
Have you an idea ?
The method getA you can see below in my code works if I call it. So the Hello world works
Create a second program in VS and call your function from there, to test.
I always use a simple console app to test, often easier to find errors in try catch in VS than in NAV
I tried this before and did it now again and it works :
But I never use VS addons, it do it from c/al.
Ok thanks.
I think that the genericity isn't supported by NAV and C/AL. Don't you think it is possible ? because here the parameter of the Load method isn't T but I think NAV doesn't understand the generic type T and the implicit replacement. The method is defined as Load<T>(T arg) and I believe that C/AL doesn't understand that.
But I know almost Nothing about NAV and C/AL so I can be wrong.
I tried to write Load<"here the type of the argument"> but it doesn't work better.
Thanks for your help
But you only use string in and out, so it should be fine.
That what I thought too...
I just looked and copy another time all the assemblies I have in the folder of the VS project in the add-in folder. Nothing new happened...