LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Server refnum casting has some inconsistencies

While implementing some generic functions, I stumbled over some inconsistencies with the "To More Specific" function used with VI Server refnums.

 

In my usecase, it happens that I cast a generic class refnum (with "To More Specific") to the same class, while the runtime class is more specific. With some class hierarchies it works fine (like Generic), but with others it fails with a type mismatch error (like ProjectItem, Scene, VI, ...).

 

Example:

I have a ProjectItem (that is actually a Library) that I try to cast to a ProjectItem -> "Type Mismatch Error"

I have a Generic (that is actually a Control) that I try to cast to a Generic -> works fine

 

To me, it seems weird that some class can be "To More Specific"-ed to themselves, while others cannot, depending on the actual runtime class. Is it an intended behaviour or is it just a lack of harmonization of VI Server refnums ?

 

Attached you'll find a showcase of all the little inconsistencies I found, and an example of my typical usecase that fails because of that.

0 Kudos
Message 1 of 2
(1,929 Views)

Looks like an insignificant bug.  There's never any reason to cast something to the same type.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 2
(1,877 Views)