Program Runs Slower When Using "Start Without Debuggin"

Thomas Kurilla 1 Reputation point
2020-08-27T21:56:41.197+00:00

I have a particularly vexing problem with more than one of my current solutions.

When I execute the program by "Start with Debugging" the code performs perfectly. No breakpoints, just execute the program. Timing on the output is as expected. Output is a sequence of records broadcast with timing based upon timestamps of the records.

When I execute the program by "Start without Debugging" the code takes between 2 and 3 times longer. Same dataset. No recompiles. Using the same executable and DLLs the timing of the output is delayed by a near constant multiplier.

I have tried removing any DEBUG dependencies, and recompiling targeting x64 rather than Any CPU.

Since similar behavior is occurring in separate projects doing vastly different things, it seems to me that there is something being done by the debugger (even though there are no breakpoints) that mitigates the issue, whatever it is.

Can anyone think of how running with debugging could possibly increase performance?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,198 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
351 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 31,246 Reputation points Microsoft Vendor
    2020-08-28T06:27:33.563+00:00

    Hello Thomas,

    I suggest you try to stop(disable) your antivirus software temporarily and kindly check if this issue is caused by antivirus software.

    Besides, please also try following steps to troubleshoot.

    1. Close all Visual Studio(VS) instances, go to your solution(project) folder, and rename(or delete) the hidden .vs, bin and obj folders, then launch Visual Studio and build your project again.
    2. Close all VS instances, open “Developer Command Prompt for VS XXXX”, type devenv /ResetSettings to reset VS settings.
    3. Please close all Visual Studio instances and try to rename (or delete) every subfolders named ComponentModelCache under this directory C:\Users\[user name]\AppData\Local\Microsoft\VisualStudio\XX.0_XXXXXX. Build your solution again.
    4. Not sure which version of VS do you use, you can try to repair VS and update VS to the latest version.
    5. Please try to create a new solution in VS and then copy(migrate, add) the contents and resources from old solution to new solution. After that build again, then check if “start without debugging” works well.
    6. If possible, please try to use the same version of VS on another machine and build your solution(projects), then check if “start without debugging” works well.

    If this issue persists, could you share a simple reproduced sample with me, and upload it to OneDrive? I will then go to test it on my side.

    Sincerely,
    Tianyu


Your answer

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