We use a lot of custom Windows services in our applications. However, the one I'm currently working on has an infuriating problem: while the service keeps running, it simply stops functioning.

The Main method of the service is wrapped in a try/catch block, like this:

```
static void Main()
{
    IRepository rep = new Repository();
    ILogger log = LogManager.GetLogger(GetType().Name);

    TimeSpan loadWindowStart = new TimeSpan(9, 0, 0);
    TimeSpan loadWindowEnd = new TimeSpan(18, 0, 0);

    foreach (SuppressionLoad sl in rep.GetSuppressionLoads().ToList())
    {
        try
        {
            // do stuff
        }
        catch(Exception ex)
        {
            // log error
        }
    }
}

```

The service also logs as it does stuff, and we can watch the logs fill up while it's busy.

Sometimes, however, the logs just stop. And activity elsewhere in the database suggests the entire service has stopped working. Checking in Services on the server, the service still shows a Status of "Started". It takes up almost zero system resources while it's in this state, although it's normally quite processor intensive. If you try and stop it, it just times out trying and, as far as we can tell, it never stops of its own accord. The process has to be killed in Task Manager.

There is nothing untoward in the log in the run up to these stalls. There is also nothing we can find in Event Viewer.

Since it doesn't log an error, I'm at a loss as to what's going on here, or what we can do to try and diagnose the fault from here. It's highly intermittent - it will often run for several days without problem before entering the state. What can we do to investigate what's going on?