Ticket Created
over 3 years ago

CIQQA-753

VS Code plugin can run the wrong PRG file if multiple PRGs exist in the bin/ directory

- Windows 10

- Visual Studio Code 1.62.3

- Monkey C Extension 1.0.0

- SDK: 4.0.6

If multiple PRGs exist in the bin/ directory, VS Code will run the first one (in alphabetical order), which may not be the actual PRG that belongs to the project. This can cause problems if a new project is created by copying an existing project which has already been built once. Seems like it would also cause a problem if the project folder is renamed.

Recreation procedure:

- Create simple data field app in a folder called TESTA, which just returns "TESTA" in compute()

- Build app and note that TESTA.PRG is created. Run app and verify that it works as expected

- Copy project folder, and change the new folder name to TESTB. Change compute() to return "TESTB"

- Build app and note that TESTB.PRG is created. Run app and note that it's actually TESTA which runs.

- Delete TESTA.PRG from TESTB/bin, and run TESTB again. Note that TESTB runs now.

  • Thanks for the response !

    "The problem is that you copy the app folder without changing the app id."

    But I've seen this problem when trying to run an app folder that was copied a long time and the UUID was changed in Eclipse. (it's a 4th clone of an app, so I rarely run it either in Eclipse or VS Code).

    When I first tried to run it in VS Code after making some source code changes, I was surprised that the copy running in the sim didn't pick up the changes. When I looked in the bin/ folder, I saw an old PRG from the original project that the clone was copied from. It surely had a different UUID, since all of my clones have different UUIDs in order to successfully upload them to the store.

    Sorry, my recreation procedure in the OP isn't very precise -- it's not the exact steps I did to recreate the problem, but just a reconstruction of what I think was necessary to recreate it.

    "the solution is to ensure your app has a unique UUID."

    This makes sense but I still think that I've seen it for apps with different UUIDs. Unfortunately I can't recreate it anymore :/ but I'll comment again if/when I can.

  • The problem is that you copy the app folder without changing the app id.

    The compiler and VSCode extension identify apps by the PRG name. The device (simulated or not) identifies apps by the UUID. If the UUID is not unique, then we must resolve the situation. I can’t remember if we delete the offending PRG or just ignore it, but the solution is to ensure your app has a unique UUID.

  • Thanks for the reply!

    I've seen the launch config and your analysis sounds plausible, but I've seen this problem with more than one project. And there was a forum post by someone who had copied their project folder to start a new project, and had issues where it seemed that the old binary was being run (which sounds similar to or the same as this problem).

    Unfortunately I can't recreate it this second, but I'll give it another shot when I have more free time.

    I will note that I use CTRL-F5 to run my app and at the time I don't think I had a launch.json configuration.

  • I've been trying to reproduce this, but based on the method of choosing the PRG that is defined in the launch configuration it doesn't seem like it can behave the way that you describe. 

    "prg": "${workspaceFolder}${pathSeparator}bin${pathSeparator}${workspaceFolderBasename}.prg",

    The PRG that is copied over to the temp/Garmin/Apps folder is based on the project folder name so changing the folder name changes both the name of the PRG that is created and the name of the PRG that is ran. 

    Is there any other information that you can give that might help show the difference between our VScode environments?