NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

.net empty array

I need to call .net DLLs from TestStand.  In one application, we need to pass a 1D array of numbers containing a variable number of elements.  In certain circumstances, this array may be empty.  We've found that when any empty array is passed to a .net DLL, we get the following error:
 
 
The array for the parameter 'XArray' is an input parameter and is empty.  All input parameters must have an expression specified.
 
It looks to me like the .net adaptor is mis-interpreting the fact that the array is empty as it not being defined.  The error message is similar to what I get if I don't define the variable to be passed to the DLL.
 
We've produced a simple sequence to demonstrate the issue, attached as a zip file.  It contains 6 steps, all of which take a 1D array and display the values of the array in a dialog.  The sequence consists of:
 
 
1.  Array of 5 elements passed to a LabVIEW VI
2.  Array of 5 elements passed to a built LabVIEW DLL
3.  Array of 5 elements passed to a .net DLL
4.  Empty array passed to a LabVIEW VI
5.  Empty array passed to a built LabVIEW DLL
6.  Empty array passed to a .net DLL
 
I can't find a work-around for this.  We're now going to do something pretty inelegant and trap the fact that the array is empty and replace its value with one element of "NaN".  Then the .net DLL will interpret this as being equivalent to empty.  There's a lot of work in this though.
 

Message Edited by Sean on 03-27-2007 11:11 AM

Download All
0 Kudos
Message 1 of 8
(4,954 Views)

Hi Sean,

Can you send me the source code for your .NET dll?

What functions are being called in this dll? Is it possible that the function is returning the error rather than the actual passing of the empty array?

What version of Visual Studio are you using to create this 2003 or 2005?

If you can send me the source then I'll take a closer look at this

Regards
Hannah
NIUK & Ireland

0 Kudos
Message 2 of 8
(4,885 Views)

Hello.  I've asked for the source code for the .net DLL.  I should be able to post this soon.  I'm fairly sure that the problem is with TestStand though.

I've made a VI that calls the same .net DLL.  It calls the method twice, with an array of 4 elements then with an empty array (i.e. the same is what I did from TestStand).  It works perfectly from LabVIEW.

You should see just the same if you make a .net DLL that takes an array as an input parameter.  It seems that the .net adaptor is incorrectly interpreting an empty array as not existing.

VI attached.

Thanks

-Sean.

Message Edited by Sean on 04-18-2007 09:56 AM

Download All
0 Kudos
Message 3 of 8
(4,848 Views)
Hi Sean,
 
This has been reported to R&D (CAR ID# 47Q9EUH8) for further investigation.
 
R&D is currently investigating this issue. At this time the only workaround would be the one you have suggested, where you do not pass an empty array to the .net adapter. We appreciate your feedback!
 
Regards
Hannah
NIUK & Ireland
0 Kudos
Message 4 of 8
(4,828 Views)

Hi,

 

I have the same issue. I'm with TestStand 4.2 and VS2008 (.NET 3.5).

 

Sometimes, the array of objects that we pass to DLL is empty. It creates an error at TestStand level.

 

Do we still need to do a work-around or it has been fix?

 

 

0 Kudos
Message 5 of 8
(4,220 Views)

By the way, the parameter is used in a constructor.

0 Kudos
Message 6 of 8
(4,213 Views)

MatLaroche,

 

This is still a known issue of TestStand 4.2.1.  If you do a search of ni.com for the ID, you'll find that NI documents known issues pretty well:

http://zone.ni.com/devzone/cda/tut/p/id/9195#51390_by_Date

 

If you're able, you might try using the TestStand 2010 beta.  The behavior might have been fixed there.

Josh W.
Certified TestStand Architect
Formerly blue
Message 7 of 8
(4,180 Views)

I recommend trying out the TestStand 2010 beta if you are able to and are using the .NET adapter a lot.

 

-Doug

Message 8 of 8
(4,167 Views)