I have a simple C# Mono 2.10 application running on CentOS 5.5 that calls
Process.Start("/path/to/myapp/myapp.exe","-someArgs");
I am able to get a process ID back and running with
mono --trace=N:System.Diagnostics
Shows me a stack that seems to indicate that Process.Start returned true:
LEAVE: System.Diagnostics.Process:Start_noshell (System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process)TRUE:1
LEAVE: System.Diagnostics.Process:Start_common (System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process)TRUE:1
LEAVE: System.Diagnostics.Process:Start ()TRUE:1
LEAVE: (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()TRUE:1
Which I assume means the process was spawned without an exception like FileNotFound etc..
However, the process seems to exit immediately and the exit code I get is 255. I assume this is a Linux exit code with some obvious meaning but I can't find anything of use on the tubes.
When launching the exact same application directly via
mono /path/to/myapp/myapp.exe -someArgs
The application launches correctly without any exception and works as expected.
Any clue what I am screwing up?
Is the file /path/to/myapp/myapp.exe an executable file (chmod +x /path/to/myapp/myapp.exe)? Mono 2.10 does check to see if the process it's starting is a managed executable, and if so will implicitly use the currently executing mono to launch the new process, e.g. Mono's CreateProcess source. CreateProcess contains all the details, but among them:
If Process.Start still fails to start your process, then that's a probable mono bug and we'd love to have a bug reported for it. :-)
Try launching "mono" as the process, and use "/path/to/myapp/myapp.exe -someArgs" as the command line arguments. That will cause the Process.Start to behave more like your normal application launch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With