04-24-2019 04:59 PM
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?
04-25-2019 04:26 PM
Hi TucsonDave,
I think you might find this forum post helpful.
04-25-2019 05:04 PM
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.
04-26-2019 08:06 AM - edited 04-26-2019 08:09 AM
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