[Mono-dev] Process.ExitCode may return an uninitlialized value

slashboot slashboot at gmail.com
Wed Jun 4 14:04:40 EDT 2008


Recently, I run into an issue where Process.ExitCode was returning numbers
out of the 0-255 range which turned out to be random numbers. I was trying
to figure out how this can happen and found that in ExitCode_internal (see
below, this is the latest revision), no checks were made on the return value
of the GetExitCodeProcess (process, &code) call which might lead to
returning uninitialized exit code if GetExitCodeProcess returns FALSE. That
doesn't look right to me..

For some reason that I still can't explain, GetExitCodeProcess was returning
FALSE and I saw this message : "GetExitCodeProcess: Can't find process 0x1"
on every process that I created (the process didn't seem to execute
correctly). Is anyone aware of such kind of problem ? (I'm using an old
1.1.17-2 version). I cannot reproduce this consistently, but each time it
happens, no more processes could be created going forward and I need to
restart the app.


gint32 ves_icall_System_Diagnostics_Process_ExitCode_internal (HANDLE
	DWORD code;	
	GetExitCodeProcess (process, &code);
#ifdef DEBUG
	g_message (G_GNUC_PRETTY_FUNCTION ": process exit code is %d", code);
View this message in context: http://www.nabble.com/Process.ExitCode-may-return-an-uninitlialized-value-tp17635993p17635993.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list