NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot call.Net static method to specify parameter

I have a Step that calls a .Net method.  One of the method's parameters is a System.TimeSpan object.  When I try to specify the parameter as "System.TimeSpan.FromSeconds(1.0)", I get the following error: "Error in call to TestStand API member 'PropertyObject.FromSeconds'. Method 'FromSeconds' does not exist in interface 'PropertyObject'."

 

Note that FromSeconds is a static method.  How do I call the method?

 

 

0 Kudos
Message 1 of 4
(2,029 Views)

Hi TucsonDave,

 

I think you might find this forum post helpful.

 

Lindsey Nestor
Program Manager, Hardware Services
National Instruments
0 Kudos
Message 2 of 4
(1,999 Views)

The post refers to a "Create Object" checkbox.  I do not see that checkbox in the Module tab of the Step Settings.  Attached is a screenshot of my Step Settings.

 

BTW, TimeSpan is a struct and not a class, if that is relevant.

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

in a separate .NET step, select mscorlib from the GAC, select the TimeSpan data type, then, instead of where you have "Use Existing Object" select the static method you wish to call (i.e. FromSeconds). Store the result in a local object reference variable, then in a second step pass that reference in to whatever is taking that as a parameter.

 

Hope this helps,

-Doug

0 Kudos
Message 4 of 4
(1,984 Views)