12-13-2024 12:56 PM
Hi all,
I am running into a problem trying to open a VI reference to a private scoped VI. I get error 1390 stating:
"You attempted to open a VI Server reference to an out-of-scope VI. A VI can open VI Server references only to other VIs that it could call as subVIs. After the reference is opened, that VI can return the reference to other VIs that could not normally open the reference."
I find this odd because the open VI reference function, it's caller, and the private VI I am attempting to access are all apart of the same class. What is more interesting is that I can replace the open VI reference function with the private VI, and LabVIEW does not throw any error.
I have attached an example of what I am talking about. Can anyone explain why this is happening? I have not been able to find any documentation that validates this behavior.
Solved! Go to Solution.
12-13-2024 02:20 PM
Your VI "String Autocomplete.lvlib:String Autocomplete.lvclass:Create.vi" is inlined, so when opening the reference to the private VI, it is as if the caller VI (Example.vi) opened it, which is forbidden. Make it not inline and it will work.
The difference of treatment compared to calling the private VI statically is because otherwise you could basically open a reference and call any private VI from any scope, which would break the encapsulation principle.
You could still open a private VI reference from a class method and give it away outside of the class, but then it would be an intentional class design choice.
Regards,
Raphaël.
12-13-2024 03:03 PM
Ahh, that makes sense, and also would have never occurred to me.
I made a number of modifications to my original code before uploading it here. Create.vi was originally a malleable VI, that is why it is inlined. It looks like I will need to find a workaround for that, but at least I know what the problem is now.
Thank you!