From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Constructor for a .Net assembly

Hi everyone,

 

I have problems with a constructor method of a Net assembly. I get the error cluster back from it, which says

error 1172

Error creating instance of Component in assembly Component, Component, Version=1.1.0.16, Culture=neutral, PublicKeyToken=null, (System.NullReferenceException: Object reference not set to an instance of an object.
)

 

When I select a different object from the assembly I get no error back.

 

I thought there would be a mistake in the constructor method of the assembly. But it works fine when I use it in VB.NET (Component = new Component).

So I'm doubting where I can find the solution for this, within the assembly (which is in the same directory of the calling VI) or within Labview ( a setting perhaps).

 

Thanks in advance,

 

kind regards. 

0 Kudos
Message 1 of 4
(3,649 Views)

Is this for a private assembly? Have you checked to make sure that any dependencies other than those that would be in the GAC are in a location that can be found (such as the same folder as the private assembly? What version of .NET is the assembly? What is your version of LabVIEW? Even with the latest version of LabVIEW, .NET 4.0 assemblies are not officially supported in LabVIEW. While in theory they should work, practice says something else.

0 Kudos
Message 2 of 4
(3,644 Views)

Hi, that's fast...

 

I use Labview 2009, it is a private assembly (it's paid, I don't know in which .net version it was created).

 

You lost me on the GAC. I thought it was not an issue since I can construct other objects from the assembly within Labview, just not the one I want.

 

It's the first time I use dll in labview programming, the design seemed really easy. I got all the constructors and property, just by sellecting them...

 

I tried http://digital.ni.com/public.nsf/allkb/7BFBDA5EBF427FB38625769B005FE77B but got no further with the "sn ... " in the command prompt and not with the gacutil thing.

Gacutil is not recognized as an internal or external command...

 

Sorry, but I'm a novice using this.

0 Kudos
Message 3 of 4
(3,639 Views)

First, bear in mind that you are not dealing with DLLs. DLLs are a completely different beast. The only thing a .NET assembly and a DLL share in common is the extension, another of Microsoft's infinite wisdom examples.

 

The GAC is the Global Assembly Cache. It's a central repository for accessing assemblies. You cannot place an assembly into the GAC unless it's signed. Any private assembly is not an island, and as such it will need to reference other assemblies. These other assemblies can be additional private assemblies, or they can be assemblies that are in the GAC (such as the "System" assemblies that are installed with .NET). Sometimes you cannot access constructors if a private assembly references another private assembly, and this other private assembly isn't there. Another reason could be the .NET version. You said the assembly you're using is paid, so you should be able to check with the vendor what version of .NET is used.

 

The procedure you linked to would not apply here. That procedure only applies if you compile your own LabVIEW code into a .NET assembly and want to place it into the GAC. You are not doing that here.

Message 4 of 4
(3,636 Views)