Problem using .NET object in NAV

leumass96
Member Posts: 9
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.






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.






0
Answers
-
-
Long shot, try using string instead of String in parameter and return.
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
0 -
You are using the integration wrong. It's not a NAV problem.
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 :
0 -
Then it should work.
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
0 -
is not directly supported, only if you create the class in c# and use it in c/al.
But you only use string in and out, so it should be fine.
That what I thought too...Could you be missing and assembly for projects in NAV service tier addin folder?
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...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions