NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Version 4 Error: Expected Container, found Object Reference

We're in the process of upgrading our sequences from 3.5 to 4.0 and for the most part, everything is seamless.  However, there is one situation I’ve found that throws a RTE in 4.0 but works fine in 3.5.  When calling SetPropertyObject on an object reference, the following error is thrown:

Parameter 'newValue': Expected Container, found Object Reference.
-17308; Specified value does not have the expected type.

Attached is a sequence snippet illustrating this behavior.  The last step should assign the variable in Parameters with the name in TempStr (“Fred” in this example) to the first element in the TraceObjRefs array (an array of object references).  

 

What is really confounding is that this works as expected in 3.5.  Any insight as to what changed or what’s the best way to work around this?

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

I got rid of the error if I change Locals.TraceObjRefs to an array of Containers instead of an array of Object References.  Not sure if that's the correct behavior but I don't get the error any more.

Cheers,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 6
(4,940 Views)
Jigg:

Thanks so much for such a simple solution; I will check with our engineers to see if we can make that change without ill effects.

Richard
0 Kudos
Message 3 of 6
(4,920 Views)
Thanks for reporting this problem. I expect it to be fixed in the next release of TestStand.
0 Kudos
Message 4 of 6
(4,881 Views)

We are seeing something similar in TS 4.1.

 

We have a container with subproperties which are also containers (of the same type actually). Technically, this is an array, we are using the container to be able to address by name. When I extract one of the sub-properties either by GetPropertyObject or by GetNthSubproperty and then try to assign it to a container of the same type, I get the error "Expected container, found object reference".

 

I attached a sequence with some experiments, using the NI_Limits type  and found a solution: the Evaluate method seems to actually copy the values from the source container to the target; but only when it is not called as "PropertyObject.Evaluate()" but stand alone.

 

But I did not quite understand the mechanics of the aliases. In the sequence, I create an alias, as indicated in the previous posts. Then I can apparently not change that alias again. I used the "Data" member in the NI_Limits container to differentiate between the individual containers.

After the second SetPropertyObject, the value stays the same as before. But when I then change the value in one of the source objects, the other changes with it.

 

So I am not quite clear what an alias actually is and what its effects are.

 

Regards

 

Peter

 

 

0 Kudos
Message 5 of 6
(4,412 Views)

I'm confused, is your question about aliases or the error you are getting? Does the sequence illustrate the error, or the alias problem (it looks like the later)? If you want help with the error, a sequence which reproduces the error would be most helpful.

 

For aliases, an issue you might be hitting is that when you want to replace or directly access the alias (i.e. using SetPropertyObject), you need to use PropOption_ReferToAlias. So, for example, if you have a call to SetPropertyObject that you want to use to create a new alias that replaces the previous one that is there, you need to use both the PropOption_ReferToAlias and the PropOption_NotOwning options as follows:

 

Locals.ThisLimit.SetPropertyObject("", PropOption_ReferToAlias | PropOption_NotOwning, Locals.LimitRef)

 

Hope this helps,

-Doug

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