This means that
ExecFile
is null at the time you are calling the
WaitForExit()
method.
According to
Process.Start Method (System.Diagnostics) | Microsoft Docs[
^], it could be that
A new Process that is associated with the process resource, or null if no process resource is started.
[...]
If the address of the executable file to start is a URL, the process is not started and null is returned.
Now it's up to you to investigate this; please use your debugger for this purpose: put a breakpoint on the process initialization line, start a debug session (F5 on Visual Studio), then execute line-by-line (F11) and watch carefully for the values held by your variables. We cannot do that for you.