Should simulator catch the use of methods introduced in a higher version?

I was trying to track down a bug on my watch face that only appeared on the actual device but not in the simulator. It turns out that using Math.round() on the D2 Bravo causes a strange white background on the actual device but no error is thrown in the simulator? Is that a bug in the simulator or is there no tracking of when a method was introduced?

Cheers,
Douglas
  • The Sim will let you use things that might not be available on the real device.

    In this case, the api doc for round() states:
    Since:
    1.3.0

    The D2 has a 1.2.x VM, so if you use round() on it, it will crash (sometimes see as a weird display with a watchface, but the crash should be in ciq_log.txt). It's the same With the APAC versions of things like the 23x and 735.

    You could use "has" to check for it, or just do your own version of round() so it works on all VMs
  • Yes, I am aware that the simulator will let you do some things that you can't do on the real device. I am also aware of the fact that the round() method in the Math module was introduced in 1.3.0 (as per the docs) and that my D2 Bravo has 1.2.x. What I am trying to ascertain (from the Garmin people) is if the simulator is supposed to catch that (in which case there is a bug in the simulator) or if the simulator is not able to catch that error in the first place. Since the simulator is able to catch (or not catch) some things (like argument count mismatches) based on the SDK version it isn't really clear if the sim should catch this also.

    Cheers,
    Douglas
  • The simulator doesn't (currently) care when a method was introduced. If you want to test how your code behaves on an old SDK version, I believe you can just install that version of the SDK and switch the SDK path.

    Travis
  • The simulator doesn't (currently) care when a method was introduced. If you want to test how your code behaves on an old SDK version, I believe you can just install that version of the SDK and switch the SDK path.

    Travis


    That's a good idea; not sure why I didn't think of that. Thanks!

    That said, since the D2 Bravo is currently at the bottom of the pile in terms of the SDK version (thanks to a belief that the liability associated with aviation devices requires a longer, slower development cycle to ensure a better quality software release) the ultimate test is for me to just push dev version to my D2 Bravo watch stuck on SDK 1.2.6.

    Cheers,
    Douglas
  • What Travis said :) I've done tests going back to an older SDK (1.2.x) , just to make sure I was using the "has" tests I needed. (it is kind of a pain to do BTW! :) )

    But even that doesn't handle everything and you have to be careful as the sim really doesn't do any device/VM tests for what you're using (today). Even for devices with the same version of CIQ (let's say a 735 and an Edge - both are 2.1.x), for example, the 735 has ActivityMonitor, while an Edge doesn't, but both run fine using ActivityMonitor in the sim, but will crash on an Edge. That's one of the reason that a simple "what's in what VM version" gets more complex for the sim, as it's really "what's in what VM (per device)", for a given VM version.

    This is by no means a new issue, and Garmin is working on making it better. I think the first time I posted about it was the va came out in March 2015, and it didn't have "phoneConnected" to show Bluetooth status. Worked fine in the sim and crashed (in those days a HARD crash!) on a real va (yet worked fine on the other CIQ devices at the time). IIRC, the expression "This is a simulator and NOT an Emulator" came up a few times! :)
  • That said, since the D2 Bravo is currently at the bottom of the pile in terms of the SDK version


    Actually, The Epix is the one on the bottom (it's still 1.2.1). What you see with the D2 is actually the same as you'd see with the APAC versions of things like the 230, 235 and 630.