showToast displays wrong string in simulator

I added a showToast to my app to help me debugging. I only use showToast in this one place in my app:

        if (WatchUi has :showToast) {
            WatchUi.showToast("onPhone", null);
        }

and a little but "later" in the code I log something:

        log("deleteTrack");

the string "deleteTrack" only appears in this one place in my code.

log is basically calling:

function log(msg as String) as Void {
    System.println(msg);
}

But for some reason this is what I see in the simulator on fr955:

Interesting. Looks like some compiler and/or simulator memory reference bug.

What's even more interesting is if I add a breakpoint somewhere after the call to showToast and before the use of the "deleteTrack" string then I see the correct string being displayed.

  • In the sim, is it only the 955?  What happens on a real device?  Is a 3rd party optimizer involved?

  • In the sim it happens to all the devices I tried (fr955, fr965, ee2). Both with SDK 7.4.3 and 8.0.0-Beta. No 3rd party optimizer.

    Regarding real device I don't know. Partially because the reason I added the toast is to help debugging something that works in the sim and doesn't (always) work on real device.

  • You want to try the real device, some things have never worked exactly the same in the sim as they do on all the real devices, especially those that use a native view.  The first was "Menu" way back when. as well as Menu2, MapView,  MapTrackView, and if I recall, ActionMenu