05-01-2020 09:59 PM
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.
05-02-2020 07:56 AM
Looks like an insignificant bug. There's never any reason to cast something to the same type.