Quantcast
Channel: AX Developer Forum
Viewing all articles
Browse latest Browse all 9880

.NET object Constructor error (Microsoft .NET Framework Interoperability)

$
0
0

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). 

 

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%2FJwWjNW8iCcBryQ9k8BKA

 

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.


Viewing all articles
Browse latest Browse all 9880

Trending Articles