Share via

Program lags when using executable and not having VS open.

BenJSamson 1 Reputation point
2021-04-27T20:10:58.473+00:00

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.

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.


1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,201 Reputation points Microsoft External Staff
    2021-04-28T07:17:48.113+00:00

    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.

    Sincerely,
    Anna

    • 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.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.