Microsoft .NET Framework Interoperability : ERROR Constructo

Tharanga_Chandrasekara
Member Posts: 11
I have created a small .net class and build the project and following is the code. Actually this has nothing just a constructor that take a one string parameter ( I have tried this even without input parameter).
After that copied the .dll file to "C:\Program Files (x86)\Microsoft Dynamics NAV\71\RoleTailored Client\Add-ins" folder.
I have attached my DLL file and project file here.
http://www.sendspace.com/filegroup/g%2F ... BryQ9k8BKA
And then i created a codeunit and create a new variable myDLL type DotNet and selected my DLL file from the Dynamics NAV tab.
It shows my class and everything was perfect to that point.
Then i wrote my small one line of code in the run() of the code unit,
it compile perfectly.
But when i run the code unit it throws the following error
Cannot create an instance of the following .NET Framework object: assembly myDLLFile, Version=1.0.0.0, Culture=neutral,PublicKeyToken=acf764e249539b6a, type myDLLFIle.Class1
I have tried so many options. But still error remains same.
Please give a small help to resolve this small issue.
Thank You.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace myDLLFile { public class Class1 { public Class1(string myString) { } } }
After that copied the .dll file to "C:\Program Files (x86)\Microsoft Dynamics NAV\71\RoleTailored Client\Add-ins" folder.
I have attached my DLL file and project file here.
http://www.sendspace.com/filegroup/g%2F ... BryQ9k8BKA
And then i created a codeunit and create a new variable myDLL type DotNet and selected my DLL file from the Dynamics NAV tab.
It shows my class and everything was perfect to that point.
Then i wrote my small one line of code in the run() of the code unit,
myDLL := myDLL.Class1('t');
it compile perfectly.
But when i run the code unit it throws the following error
Cannot create an instance of the following .NET Framework object: assembly myDLLFile, Version=1.0.0.0, Culture=neutral,PublicKeyToken=acf764e249539b6a, type myDLLFIle.Class1
I have tried so many options. But still error remains same.
Please give a small help to resolve this small issue.
Thank You.
0
Comments
-
Hi,
NAV wants to call implicit constructor of desired class. Change your code to call MyDLL.Class1(); and assign myString as property.0 -
I solve the issue. It was a small thing. In the .NET variable i just have to select RunOnClient : true0
-
You can run it on server too, but than you need to install the dll to the server too... ;-) of course, depends on what it should do. You cannot display windows etc. when running on server...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