I'm working on a small Windows Forms App (.NET Framework) project. It mainly consists of a backgroundworker. The backgroundworker starts by breifly listening for a CAN message with a certain ID. The data part of the message is a byte array where each value indicates how far a physical lever has been pulled (there are 8 levers and the array contains 8 bytes). It then uses a ProgressChanged method to update 8 labels with the corresponding lever data.
The issue I'm having is that when I run the program, by using the executable generated from building the project, and pull a lever, there is an extremely long delay (30+ sec) before the levers label value is changed. However, if I have VS open in the background (could be a completely different/ empty project) I get no lagg, and the labels are updated pretty much instantly. I can also run the program directly from VS without any issues. Does anyone know why this happens?
I have seen that the lever values are updated instantly on the CAN bus when a lever is pulled, so the lagg is somewhere between me reading the bus and displaying the values in the form.