Very slow starting of C# programs made with Visual Studio ??

KeldSor 351 Reputation points
2022-06-23T06:38:13.183+00:00

Years back I made some C# programs and have used the EXE-files since then, but lately - a year or two - I noticed they are very slow to start - and we're talking 20-30 seconds from I 2-click to the userface shows up.

Why and how can I make them faster ?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,279 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Castorix31 81,746 Reputation points
    2022-06-23T07:18:40.78+00:00

    They start immediately on my OS, Debug or Release
    (Windows 10 21H1, VS 2022)

    Random exe =>

    214224-startexe.gif

    0 comments No comments

  2. KeldSor 351 Reputation points
    2022-06-23T08:46:13.357+00:00

    I now downloaded 4.8 as explaned here:

    Severity Code Description Project File Line Suppression State
    Error The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks KSPause

    but still it wants I get this error !

    I think it has to do with references ... but where are they 'hidden' in the VS2022 ... I haven't worked in VS since VS2008 !


  3. Rijwan Ansari 746 Reputation points MVP
    2022-06-23T13:46:58.83+00:00

    Hi @KeldSor

    Since your application is using older version of .Net Framework, it is recommended to upgrade to latest version. However, it is not only the reason for slowness.

    You can do following troubleshoot:

    1. Check startup functions like form load or preload. You can write log with time to know the execution time.
    2. Avast Antivirus also uses a technique called "Deepscreen" which check excutable files before they are allowed launch. I added an exception for the path to the application in Avast Exlusions setting screen and it now starts instantly without any abnormal delay.
    3. Check if you are connecting to any external DB or Network files are okay
    4. Also use release file not debug one
    5. Try with some other machines to verify
    0 comments No comments