This issue has been infuriating me.
I have a C# Windows Forms application (let's call it App) which starts and manages a C++ high-performance executable (let's call it Compute).
So the process tree in the task manager looks like
_App.exe | CPU | Mem | Disk | Network |
|_Compute.exe | CPU | Mem | Disk | Network |
I want the App to run automatically at startup. So far I've tried putting it in the shell-startup directory (can be found by win+R search 'shell:startup') or adding it to the HKeyLocalUser startup part of the registry. I found those solutions on Stackoverflow here.
When testing it out, the App starts just as expected when you log-on or startup the machine. But Compute.exe does not start properly. The process tree looks like:
_App.exe | CPU | Mem | Disk | Network |
|_App.exe | - | - | - | - |
It looks like the app is being started as a subprocess of itself, and with no resources. Again - the UI of the parent App starts just fine, is interactable, etc. But it is never able to restart the Compute process - even if forced to by the App process.
I believe it has to do with who starts the App, and that that ownership transfers to the child process. It goes without saying that manually clicking the startup shortcut launches the App and child Compute process no problem.
Any thoughts on what I'm missing here? Thanks for the advice!