0

I'm trying to start my application through the Process.Start(), this is done by returning true, but the fact is that the window does not open and there is no process in the Task Manager, no error code returns, after a while the event is an exited returns the exit code -532462766

class Program
{
    static void Main(string[] args)
    {
        var pr = new Process();
        pr.StartInfo = new ProcessStartInfo(@"Debug\Browser.exe");
        pr.Exited += Pr_Exited;
        var started = pr.Start();
        Console.WriteLine(started.ToString());
        Console.ReadKey();
    }

    private static void Pr_Exited(object sender, EventArgs e)
    {
        var exc = ((Process)sender).ExitCode;
        Console.WriteLine(exc.ToString());
    }
}
  • 3
    Please provide some example code of what you are trying to do. https://stackoverflow.com/help/mcve – Jim L Sep 30 '18 at 17:30
  • 1
    Hello and welcome to StackOverflow! It is advised to **not** post an image of your code, but rather to put the text in your post with [proper formatting](https://stackoverflow.com/editing-help). – absoluteAquarian Sep 30 '18 at 21:59
  • Why is this tagged C (it is not C code) and not C#? – chux - Reinstate Monica Oct 01 '18 at 21:10
  • Have you tried starting other programs; for example, `pr.StartInfo = new ProcessStartInfo("notepad.exe");`? I ran your code , per my modification, and NOTEPAD started; however, I didn't get the ExitCode notification on exit of NOTEPAD – Bill Roberts Oct 01 '18 at 22:46
  • -532462766 = 0xE0434352 (and 434352 = "CCR"). Here's [an old answer](https://stackoverflow.com/a/14897073/243245) with a suggestion from Hans Passant: add [a handler AppDomain.CurrentDomain.UnhandledException](https://learn.microsoft.com/en-us/dotnet/api/system.appdomain.unhandledexception?redirectedfrom=MSDN&view=netframework-4.7.2) to catch the exception and work out what's going wrong. – Rup Oct 01 '18 at 23:05

0 Answers0