what does mono returns code 249 means?
I believe your application exits with the -7
error code. The number is negative because libc
appends the minus sign to all error codes returned by the kernel syscalls (which are positive integers). Eventually, bash
converts -7
to 249
through $?
.
test.sh
#!/bin/bashexit -7
Calling test.sh
bash test.sh$?249
Mono Return Codes:
0 or -1 (255 in posix) for Main Entry points of void type
- Note: If the return type of Main is void, -1 is only set the exitcode if an un-handled exception was thrown
Any int value for Main Entry points of int type
- Posix/Bash will box that to 0-255 due to historical exit code (lower 8 bits) and status (upper 8 bits) (unless you are running a posix 2001 system ;-)
- Full int values can be optained by exec'ing (system/fork/spawn/etc...)
Again, -1 is 'reserved' for exception based exits...
Based on the entry point having a std MONO_TYPE_I4 (0x08) return signature:
MonoObject *res; res = mono_runtime_invoke (method, NULL, pa, exc); if (!exc || !*exc) rval = *(guint32 *)((char *)res + sizeof (MonoObject)); else rval = -1; mono_environment_exitcode_set (rval);
And assuming you do not have your program running and corrected to a debugger and are not setting the exit code yourself, getting a exit code of 249/-7 means a non-standard exit and based in the limited exit points and the areas that can the exit code, I'd look for a thread you are not cleaning up (i.e. a managed thread becomes a 'native' pthread on OS-X or a __thread on Linux or ....) or some other managed to native/interop process hanging open (GPU, filesystem operation, etc...).
You can always run your app "MONO_LOG_LEVEL=debug mono someapp.exe" and lookup at the shutdown/exit trace.