C#: Executable is much slower if launched outside Visual Studio (2013, 2019)




I faced to a problem while coding at the end of my project (c#).

Everything was okay in developing stage.

I was coding and testing software in Visual Studio by pressing F5 / Ctrl+F5 (with and without debugging.

Computation time was around 40-50 minutes and it was okay.

Then, while testing, I prepared installation package.

... and problems apperared.

When the program was started as normal application (by double-click in the file explorer), the speed droped and the computation time was extended to around 6 hours!

Could anybody give me a hint what could be the reason?

What is the difference between program start by Ctrl+F5 (launching without debugging) and “normal” start of a windows application by double-click?

Does Visual Studio apply specific environment for programslaunched in VS?



The second dll – nx.dll – is loaded into Siemens NX to perform CAD operations.

Dlls “base_func.dll” and “nx.dll” communicate using WCF.

I noticed already:

1. The same behavior for debug and release compilations.

2. Compiler settings have no effect.

3. Installing using NGEN has no effect.

3. Integrating“base_func.dll” into “myprogram.exe” makes no difference.

Any hint?


I found the reason, however, still I don't undesratnd why.

The root cause were text messages - all communication messages between dlls were storing on the fly in a txt file. There were usually 200'000 lines. This is not big number for me, but 200'000 strings could make the delay.

However, still, why this is not a problem when program launched from VS?

Continue reading...
Top Bottom