Program lags when using executable and not having VS open.

BenJSamson 1 Reputation point

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.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
2,451 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 11,206 Reputation points Microsoft Employee

    Hi @BenJSamson ,

    Welcome to Microsoft Q&A!

    According to your description, I suppose it may be related to your project or your machine.

    Have you tried to run your project on other machines?
    You can check if there are third party software installed on your machine or not. And that may affect the performance of executables outside Visual Studio.


    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    No comments