ProcessStartInfo doesn't start application and Error code -532462766

2.7k views Asked by At

I'm trying to launch an application from another using System.Diagnostic.Process that way :

if (this.isRequiredFieldFilled())
{
    ProcessStartInfo start = new ProcessStartInfo();                

    MessageBox.Show("PIC" + up.pathPIC);
    start.FileName = up.pathPIC;

    //start.WindowStyle = ProcessWindowStyle.Normal;
    //start.CreateNoWindow = true;
    int exitCode;

    try
    {
        using (Process proc = Process.Start(start))
        {
            proc.WaitForExit();
            exitCode = proc.ExitCode;
            MessageBox.Show(exitCode.ToString());
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show("Exception  -> " + ex.Message);
    }

}
else
{
    //TODO Handle input
}

I can see the spinner but nothing apear and i receive the return code -> -532462766 I don't really understand because, when I double click on this application there is no problem, and if I launch another app from my process it work well too.

Did I miss something ?

1

There are 1 answers

0
gman On

I received similar error when I was trying to run a windows application from an SSIS package. When I went to the Windows System Event viewer, I was able to see the exact error that was causing the issue. There was an access error and the service account running the application didn't have access to a particular resource. When I resolved the access issue, the process started running successfully.