TestStand Run-Time Error -17308: Specified value does not have the expected type

Updated Feb 3, 2023

Reported In

Software

  • TestStand

Issue Details

I am trying to use the GetUpperBounds method to obtain the upper bounds of my 2D array using the ActiveX/COM module Action step, but I receive the following run-time error when I put an object reference variable to my local array as the Object Reference parameter in the Step Settings. How do I properly call the GetUpperBounds method using the ActiveX/COM module? 
Run-Time Error: 
Incorrect object reference type in 'Locals.LocalArrayRef'. 
Expected a reference to an object of type 'ArrayDimensions'.

ERROR CODE -17308
-17308; Specified value does not have the expected type. 

error17308.PNG

Solution

The Object Reference parameter must be pointing to the Object Class you will be using to get a property or call a method from that specific class. For instance, for the GetUpperBounds method, it is part of the PropertyObjectType.ArrayDimensions class and is not a method of the actual array. Therefore, you must access the PropertyObjectType.ArrayDimensions class of an array, which you can do by using the following syntax if you have an array as a local variable: 

Locals.<name of array in Variables window>.Type.ArrayDimensions

Following is an example screenshot of all the Step Settings for an array named 'LocalArray' that is part of the local variables.
StepSettingsforActiveX_GetUpperBounds_LocalArray.PNG