Simulation Restart/Code Replace Not Working

For some reason, when I run simulation on the team’s primary programming computer (which we got in 2023) and click on the restart or hot code replace buttons, the simulation just restarts without changing any of the code. The real problem with this, however, is that the simulation runs fine on every other computer I have tested with so far. I have tried reinstalling WIPLib, VSCode, and FRC Game Tools and there was no change to the behavior. Does anyone know of any recent dependencies that might have broken the simulation?

Reproductions is as follows (if your computer so happens to have the same error)

  1. Make (or open) a WPILib 2024 project
  2. Make a quick print statement in robotPeriodic to say something, let’s go with “Hello World” for this example.
  3. Run your simulation. Wow, that’s a lot of prints. Let’s get them out of here!
  4. Remove the print statement from the code without stopping the simulation
  5. Click hot code replace. If your computer is having the same problem as mine, then it should say in the bottom right “Cannot find any changed classes for hot replace!” Okay, well if that doesn’t work, surely restarting the simulation (without clicking the stop button, I’m talking about that little green arrow to the left of it)
  6. Restart the simulation. We got the whole restarting message, and the prints might have stoppe-- oh the print statements are back. Hello World!

Code_ZkX2g7g9V9

1 Like

Experiencing this also

Regarding clicking restart, I assume it doesn’t rebuild the code, which is why the prints reappear. In general we do not recommend using the stop/restart buttons in vscode, but instead closing the simulation window (stopping the sim in vscode like that won’t save any of the GUI settings).

What’s strange is that those buttons work great on other computers, so it makes me think might be an issue with the viscose environment i’m running on.

Is the hot code replace and simulation restart a vscode feature as not a WPILib one?

Correct, these are VS code features (provided by the Java extension).