2

I made a program which works perfectly fine when I launch it manually but I added it to the run key on registry to auto start it on windows start up. Whenever I restart the OS to check if the start up works, I end up getting this error and the application crashes:

Description:
  Stopped working

Problem signature:
  Problem Event Name:   CLR20r3
  Problem Signature 01: myApp.exe
  Problem Signature 02: 6.3.9600.16384
  Problem Signature 03: 5837dc5a
  Problem Signature 04: System
  Problem Signature 05: 2.0.0.0
  Problem Signature 06: 4ca2ba90
  Problem Signature 07: 3aa1
  Problem Signature 08: 288
  Problem Signature 09: System.ComponentModel.Win32
  OS Version:   6.1.7601.2.1.0.256.1
  Locale ID:    1033

But even after the crash, if I go to the folder and launch the app manually it works perfectly fine. What could be the problem? Is it that System.ComponentModel takes time to load up or something? If thats the case then what might be a solution to fix it? TIA.

EDIT: Traced the cause of the problem:

System.ComponentModel.IContainer components = null;

I think System.ComponentModel takes some time to load.

J. Doe
  • 21
  • 3
  • 1
    It might be helpful if you show your code... – Fang Nov 25 '16 at 07:59
  • I don't know which part should I show, its a big project file, and since it works fine on manual launch I have no clue where the error might occur for me to select that part of the code to display here. @Fang – J. Doe Nov 25 '16 at 08:02
  • It is your task to provide an MVCE (http://stackoverflow.com/help/mcve). – Fang Nov 25 '16 at 08:04
  • Have you set `Working Directory`? http://stackoverflow.com/questions/2822951/use-registry-to-startup-a-program-and-also-change-the-current-working-directory – Ali Bahrami Nov 25 '16 at 08:07
  • its all in one directory and I don't need to access any other exe, just myApp.exe is sufficient for the app to start. @Ali – J. Doe Nov 25 '16 at 08:10
  • this is where it causes the problem: private System.ComponentModel.IContainer components = null; @Fang – J. Doe Nov 25 '16 at 08:34

0 Answers0