[Mono-list] mono-service2 debugging

Robert Jordan robertj at gmx.net
Tue Sep 8 05:42:32 EDT 2009


nzsaint wrote:
> I am trying to use mono-service2 to run a windows service under openSUSE
> 11.1. I am currently receiving an error message (object reference not set to
> an instance of an object) in the syslog in relation to my service but I
> would like to obtain more information to specifically identify the cause of
> the problem. Currently I am using 'gnome-system-log' to view this error
> message.
> 
> How can I obtain details of the error that occurs e.g a stack trace? I am
> logging from my application to a text file but it appears that this error is
> occurring before the logging in my application. The '--debug' option doesn't
> appear to make any difference to the error details I receive.

Try this:

mono --debug $monoprefix/lib/mono/2.0/mono-service.exe yourservice.exe

Replace $monoprefix by the current prefix of your Mono installation.
Note that the service won't be backgrounded when invoked like this.


Another approach:

Try to change the entry point of your service:

static void Main (string[] args)
{
	new YourServiceClass().OnStart(args);
}

and debug it standalone (mono --debug yourservice.exe).

Robert



More information about the Mono-list mailing list