Visual Studio Code: Save Fail

I'm brand new to VSC, after many years in Eclipse.

After a day, I really like it. But I'm new to it. I've noticed one unfortunate behavior...

After editing one of my MC files, I notice the little file icon on the upper left indicated an unsaved file. Nice indicator. I'll hit CTRL-S or go to File-->Save or Save All. The indictor resets. All files saved. Then I'll Run w/o Debugging and Select my Device. And it'll run the PRIOR code. Ugh. I'll go back to File->Save, and try again, and it'll usually run the right code this time.

What am I doing wrong?

Thanks!

Top Replies

All Replies

  • Are you sure that it's literally the saving of source files that's failing, or is it possible that:

    - the build isn't always triggered after saving file(s)

    - the simulator isn't always running the latest PRG

    You can test these various scenarios:

    - File is actually saved: Open project source folder in Explorer. Save a file and verify that the last modified timestamp of supposedly saved file changes. (You can use the Properties dialog to get per-second resolution, or you can open the saved file in another editor to ensure that your changes have actually been saved)

    - Build is triggered on save: After saving files and pressing Run, look in the console and ensure the compiler runs. Check the last modified timestamp of the PRG file in the bin folder

    - Simulator is running the latest PRG: If the previous 2 scenarios work and the simulator still isn't reflecting your latest changes, then it's not running the latest PRG. You can look in the simulator's apps folder to ensure that its copy of the app PRG is the same as the one you just built.

    On Windows, the simulator root folder is %TEMP%\com.garmin.connectiq\GARMIN, and its contents/layout is similar to what would be found on a real device. The simulator's apps folder is %TEMP%\com.garmin.connectiq\GARMIN\APPS

  • Today I had the same problem!

    I'm on VS code since forever and I'm still on SDK 6.2.1.

    Today I just annotated (// commented out) 2 lines of code (which wrote something to the screen), but after the build they were still output to the screen.
    I built a second time (without changing anything in the code) and then the lines were gone.

    I was able to reproduce this problem!

    Never noticed that before…

    Remark:
    the second build was done in no time - means: there was no new compilation but apparently only a new load to the simulator!

    Seems to be not a „save fail“ but a simulator cache problem.
    I‘ll „kill all apps“ in simul - let‘s see…

  • I'm facing this problem now with every compilation. Simul always shows the previous code version first.

    My work-around for now: before closing the simulator I press Ctr+A (kill App).
    That works for the next compilation to show immediately. 

    Strange, because I'm still om 6.2.1 - simul too!
    Never happens till 2 days ago.

    It's a cache problem!

  • How are you building/running in VSC?  I started using VSC when it first came out and completely stopped using eclipse maybe 10 months ago.  And I don't have this issue.

    As a test, I edited an mc file for one of my apps making a change that was visible in the sim so it was easy to see if I was running the newly edited version.  And 10 out of 10 times, the change was visible in the sim - without closing the sim or doing anything else.  This was a watch face and I'm currently using the 6.3.0 SDK.

    Here's how I do things:

    First I select a run config, using this menu you get when you select the bolded icon.


    (if you move down the list you can add a new config)

    Then to build/run, use the "Run" menu, and run with or without debugging.  You always get prompted for the target device, and the last one you used is always on top of that list. 

    If you use "Build Current Project" in the workspace explorer, it will build that app, but it won't run it and then doing a run with or without debugging may not work as expected.

    The way I do it is consistent.

  • Hi Jim! 

    Many thanks for your input.

    I normaly simply press <F5> and then chose the device I want to build.

    But there are news:
    I installed 6.3.0 and now the problem seems to has vanished.
    Each new compilation is shown now in the simul.

    Thanks a lot!

  •  and Jim. One more issue. I'm about to release a cool new data field. Developing in VSC. I totally redid the User Settings. All my XMLs are fine (strings, properties, settings). But when I run the field in the simulator (Ctrl-F5), and go to Edit Persistent App Settings (Ctrl-P), it remembers the old, non-existent set of User Settings. I've CLEANED the projects, and removed the "bin" folder and restarted VCS. Doesn't help. Ugh. Another cache issue. Any ideas?

    I closed VCS and opened the field and Eclipse, and the App Settings worked. Then went back to VCS and now they are working as expected. Weird. So Eclipse cleared the cache.

  • I will have an eye on it. Did not change setup the last days, when I had the other cache problem…