-1

I wrote a .net 4.0 mono service called snserver.exe and am hosting it on a Raspberry Pi via mono-service.

In order to run it, I execute the following line:

mono-service -l:/var/supernovaServer/snserver.lock /var/supernovaServer/snserver.exe

After a few hours or days, the process terminates and leaves the snserver.lock file in place. A StreamWriter used by the service hasn't flushed, as evidenced by partial output. Furthermore, it seems that even the custom exception handler I wrote (AppDomain.CurrentDomain.UnhandledException event) doesn't fire.

How can I diagnose a crash like this?

1 Answer 1

1

I work with mono and logging service crashes is nearly impossible. But there is a trick, if you execute the service using mono instead of mono-service combined with the screen command you can get every detail of the exception.

Execute it with this:

screen -dmL mono snserver.exe

This will create a new screen session and launch the program in interactive mode, you can restore the screen whenever you want to check the output and if it crashes the screen command will create a log file with all the output from the console.

Once you have debugged the service you can return to use mono-service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.