I'm facing a weird problem. I have an executable (Exe1) which I register in the RunOnce key (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce) Exe1 is run on the next restart. In Exe1, I'm using Process.Start() to launch another executable (Exe2). The syntax is
string Installer = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Exe2.exe";
Process.Start(Installer);
Strangely, the Exe2 is launched twice sometimes and sometimes not. I'm not able to figure out how. Exe1 is launched only once at the startup. I'm sure - I'm taking these steps.
In spite of all this, Exe2 is launched twice. And this happens when its started from RunOnce on reboot. It does not happen if I launch Exe1 directly.
Appreciate any help or useful information
I'll speak to the issue I encountered since it may be close enough to your issue. First, I placed a break point everywhere I expected my process to start. If the process starts without me continuing, then my code triggered the process elsewhere.
Process myProcess = Process.Start(startInfo);
myProcess.Start();
I placed a break point on the second line, but clearly I was triggering the process on the first line. Those wonderfully (annoying) simple mistakes are sometimes hard to spot if the code is dispersed. Hope that helps or anyone else hitting this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With