On some computers, when I call Process.Start()
to start my helper executable, I get the following exception:
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
The question: when I get Win32Exception
, I want to tell if this is the "file not found" exception I described or something else. How to do this reliably? Should I compare this 0x80004005
against something, or should I parse the error message?
Some explanation: the executable may get removed by for some reason (that's why file not found). This is an expected situation. If the exception was thrown with some other reason, I want to report it.