GetManufacturerProperty() not working

Post Reply
ColinP
Posts: 952
Joined: Mon Aug 03, 2020 7:46 pm

GetManufacturerProperty() not working

Post by ColinP »

Just to alert other devs to an issue when using the GetManufacturerProperty() method of the VoltageModule class.

It doesn't work correctly at first in VMD. You need to publish the module and perhaps also let it download in VM rather than just VMD before it works as expected. I'm not sure of the exact details of what eventually gets it to cooperate. I just know it fixes itself if you persist doggedly.

I've encountered this I think three or four times over the years now but it still keeps tripping me up, especially when reversioning an existing module as I sometimes do when working on big projects. Each time I've spent hours trying to track down a mysterious bug before eventually my aging brain says "hang on we've been here before you idiot".
User avatar
ChR_is
Posts: 107
Joined: Wed Sep 22, 2021 5:48 pm

Re: GetManufacturerProperty() not working

Post by ChR_is »

Always make sure to add sane default values and to check retrieved values:
Check property string
Check property string
ErrorCheckingProperties.png (3.71 KiB) Viewed 897 times

When adding a module for the very first time, the manufacturer properties can not exist. how would they? so your module must be able to deal with missing data.
ColinP
Posts: 952
Joined: Mon Aug 03, 2020 7:46 pm

Re: GetManufacturerProperty() not working

Post by ColinP »

ChR_is wrote: Wed Jan 17, 2024 6:07 pm Always make sure to add sane default values and to check retrieved values:

When adding a module for the very first time, the manufacturer properties can not exist. how would they? so your module must be able to deal with missing data.
I obviously do a check and safely ignore properties that don't exist but in a complex system this just produces missing functionality for no obvious reason.

Why should a manufacturer property not exist once set? They are just stored locally in an XML file at AppData\Roaming\Voltage|Settings under Windows. It's all pretty low tech.

Emphasis on "once set", I don't expect VM to predict the future. Basically the problem is that VMD doesn't fully reproduce the behaviour of VM but it's easy to be tripped up by this so I thought it worth reporting.
User avatar
ChR_is
Posts: 107
Joined: Wed Sep 22, 2021 5:48 pm

Re: GetManufacturerProperty() not working

Post by ChR_is »

VMD and VM have their own cache and settings in %APPDATA% (and mac equivalent thereof) afaik.
ColinP wrote: Wed Jan 17, 2024 6:41 pm Why should a manufacturer property not exist once set?
a) it cannot be set when loading a module for the very first time. that is always going to happen to every user at least once.
b) the settings could be deleted. a re-install could wipe the user settings or a user could clean up manually. there's always a possibility.
c) files can corrupt. it happens way less frequently than it used to, but it's still possible.

but you're right. VMD and VM behave differently in some situations and edge cases. in my experience manufacturer properties have not been part of this, but i'll keep an eye on it in the future. thanks for reporting/letting us know anyway! :)
ColinP
Posts: 952
Joined: Mon Aug 03, 2020 7:46 pm

Re: GetManufacturerProperty() not working

Post by ColinP »

By the way it's not something simple like Get/SetManufacturerProperty() just not being implemented in VMD.

Once you've published the module, downloaded it and got things running in VM then the methods work as expected in VMD. In other words you can then both read and write properties in VMD with no further involvement of VM. So I guess there must be some state in CA's files that VM turns on before VMD will handle properties correctly.
Post Reply

Return to “Module Designer”