Under Review
over 2 years ago

Missing entries in not handled the same in sim vs real devices

If you have a entry in <properties> but forget to add it to <settings> then saving settings in the sim via Ctrl-P works fine.  However, on the real device, when you save the settings via Connect IQ app, the missing Property is deleted on the device which then causes an unhandled exception when trying to fetch the value via Properties.getValue().

Normally, you'd think this would never happen because normally settings are simple and you'd notice them missing <settings> entry in the sim properties window.  However, when trying to support as many devices as possible, the limited memory on some require a different set of settings and it's easy enough to miss the missing setting when testing.

What makes this a more serious issue that you have to export a release version to beta and the bug reporting system is not reliable in getting bug reports.

IMO it is a bug that the real device deletes the property (or sets it to Null; I'm not sure which is happening).  But, I suspect it is easier to fix the sim to behave like the real devices.  This at least makes it a LOT easier to catch this bug.  It took 2 days of pushing various beta versions to multiple devices to finally figure out that the property is either gone or null; neither of which should ever happen if a property is defined, with valid values, in the <properties> file.

Thx,

Pete

Parents Comment Children
  • I have the same but in my case exception isn't thrown:

    Error Name: Unhandled Exception

    When bad name of property:

    Error: Unhandled Exception
    Exception: Key does not exist in Application Properties

    You can  generate this case in sim

    - fill memory near to the limit

    - run settings, change something and save - usually you show message "unable to serialise settings", in memory viewer there is no settings!

    - now try to read settings and "my case"

    It it should be:

    - reading dictionary

    - showing settings

    - updating dictionary

    But probable new dictionary is created (hence big peak) and app has older object or null.

  • I have a common function that calls App.Properties.getValue() and have that inside a try/catch, where in catch, I return a default value.  Properties/setting are often the last time I add before publishing, and this works great,.