NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to pass structures from test stand and accept structure in c#

Hello Friends, 

 

I have encountered an issue in passing structs in .Net Adapter of Test Stand.

Situation is:

1. I have created a structure (containing array of other structs) in C# assembly.  

2. Created type using this struct.

3. Need to pass to a method as parameter, but getting run time exception.

4. Also I cannot return the same struct as any method output. 

 

Error displayed as: -17311; Could not accept the parameters passed in.

 

Its working fine in C# method, I am able to debug and get access to the fields.

 

Please suggest.

 

Thanks,

Rajender 

0 Kudos
Message 1 of 6
(4,516 Views)

You  might want to have a look at this:

http://digital.ni.com/public.nsf/allkb/B82CEF98538DCA078625741600203A2E?OpenDocument

Shreyas Hebbare
Shreyas Technologies
India
0 Kudos
Message 2 of 6
(4,485 Views)

Rajender -

 

Did you create a Custom Data Type within TestStand for your struct? If so, did you enable .NET Struct Passing in the custom data type Properties dialog? What version of TestStand are you using?

Manooch H.
National Instruments
0 Kudos
Message 3 of 6
(4,463 Views)

Do you by any chance have any fields that are of type System.Object rather than a more specific type? If so you need to make the variable type be a more specific type or Object Reference type in your TestStand type definition.

 

Hope this helps,

-Doug

Message Edited by dug9000 on 11-23-2009 01:08 PM
0 Kudos
Message 4 of 6
(4,458 Views)

Rajender -

 

Attached is an example of passing a Struct of an Array of Structs to a .NET code module and passing it back to TestStand as a return value. Note that you have to have a custom data type in TestStand for all three components, the inner struct, the array of structs, and the struct of array of structs, and all three custom data types must have the Allow Objects of This Type to be Passed as .NET Structs option checked in the .NET Struct Passing tab of the custom data type Properties dialog.

 

Please take a look at this example and try to implement its concepts in your own sequence file. The "Struct Passing Example.seq" sequence file is saved in TestStand 3.5 so it can be opened and executed in any version of TestStand 3.5 or later.

 

Hope this helps.

Manooch H.
National Instruments
0 Kudos
Message 5 of 6
(4,424 Views)

Hello Manooch

 

Thanks for your efforts, I really appreciate the time you have devoted to resolve the issue.

Even though I will dig some more in my application and will let you know the exact detail of the problem.

 

But thanks anyways, for your concern.

 

Thanks,

Rajender 

0 Kudos
Message 6 of 6
(4,413 Views)