experchange > dotnet.languages.* > dotnet.languages.csharp

Anton Shepelev (05-08-19, 01:31 PM)
Hello, all

I have a singel-threaded Windows service in C#. Its main
loop is wrapped in a `try' block, and I am logging the
exception the `catch' block. I have also subscribed to

AppDomain.CurrentDomain.UnhandledException

and am logging it too, as well the Start and Stop commands.
Yet my client reports that sometimes my service stops
without writing anything in the log. What can be the cause
if the log file is accessible (the service adds an entry at
start-up) and nobody is stopping the service process via
Task manager (I belive them they don't)? How can I diagnose
the situation?
Arne Vajh°j (05-12-19, 03:28 AM)
On 5/8/2019 7:31 AM, Anton Shepelev wrote:
[..]
> start-up) and nobody is stopping the service process via
> Task manager (I belive them they don't)? How can I diagnose
> the situation?


Any chance that the application is running out of memory?

Any native code involved?

Anyway - difficult scenario.

I would suggest extensive trace logging to try and determine
where it stops.

Arne
Marcel Mueller (05-12-19, 08:57 AM)
Am 08.05.19 um 13:31 schrieb Anton Shepelev:
> Yet my client reports that sometimes my service stops
> without writing anything in the log.


There are two exceptions that can't be handled gracefully:
- out of memory and
- stack overflow.
An of course unmanaged code may always cause crashes as well.
There is also a small chance that race conditions crash the entire
application. Even if your service is single threaded AFAIK this does not
apply to SCM events.

Have a look at the system logfiles. Unhandled program terminations are
usually logged there.

Marcel
Similar Threads