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: 

Using a custom .NET assembly's functions not working anymore (says VI is broken)

Dear Communitiy,

 

I have a .NET assembly (dll) which contains some custom data mining functions, also used by another colleagues (from different systems). I had a working version, using the .NET constructor / invoke / property nodes. Then, I changed some of the C# methods not only give the result, but also the SQL (using actually a tuple), like (string[] a, string sql) instead of just string[] a.

In the LabVIEW (2015) block diagram, I had to add some .NET property nodes to the invoke node. So, at the end, everything looks fine, the VI is not broken, runs fine, gives the expected result. I saved it, closed it, and set it as startup VI in the project, but when trying to build an executable, it says that the VI is broken, and lists a huge amount of errors:

 

Cannot complete build because following VI loaded broken:

C:\Users\ed4310\Source\LabVIEW_2015\SZ_KO_PD\DV\DV Status Query App\STARTUP call.NETassembly.vi

Open the VI in LabVIEW and fix the listed errors. If the VI loads as expected but errors are still detected during the build, contact National Instruments technical support for assistance.

Broken VIs:
- STARTUP call.NETassembly.vi:
Invalid refnum class
Invalid property
Invalid refnum class
Invalid property
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
Invalid refnum class
You have connected two terminals of different types.
N is not wired, and there are no indexing inputs.
Invalid refnum class
Invalid refnum class
You have connected two terminals of different types.
You have connected two terminals of different types.
You have connected two terminals of different types.
Invalid refnum class
Invalid refnum class

 

I have attached the VI, and also a screenshot. Before the assembly change, there were already some methods returning a tuple, and there was no problem at all. The block diagram seems correct for me (especially that it runs as it should), so I have no idea what happened that I get these error list. Any help or hint is welcome!

 

Thank you! Zsolt

 

 

 

 

Download All
0 Kudos
Message 1 of 4
(858 Views)

Dear Community,

 

I have made some investigation, and found that there is a problem if the tuple contains a custom class, like here:

 

public (TestIdDataDef[] tdd, string sql) GetTestListToDV(string DvNum) {...}

 

The method returns an array of the test data definitions (which is a custom class) and the SQL for debugging. In short, if the first member of the tuple is a built-in type, like string[], no problem with the same method.

 

If I remove the tuple, just returning TestIdDataDef[], no problem as well. I fixed it this way, but I would like to know why this happens, if possible.

 

Thank you!

Message 2 of 4
(818 Views)

@vilagvevo wrote:

If I remove the tuple, just returning TestIdDataDef[], no problem as well. I fixed it this way, but I would like to know why this happens, if possible.

Sounds like the dependency is missing?

 

Or perhaps a custom class in a tuple is simply not supported?

 

What happens when you return just the custom class?

 

Can you force the custom class in memory? 

 

Is the custom class in the assembly? Is it exported? Public? I'm no expert, but these things might make a big difference. Having a custom class as output doesn't make it public automatically. 

0 Kudos
Message 3 of 4
(811 Views)

I'd say it is probably just better to change your API since that is under your control. Consider creating a generic Result type or using out parameters.

Message 4 of 4
(804 Views)