title: Using async event handlers in C# windows services
body: <p>I have a C# (4.8) windows service. All it does is OnStart it registers some event handlers which gets called by a messagequeue when a message arrives and the event handler to process it. The event handler calls a library method to process it. This is all synchronous. Now as part of making everything async await pattern, all the processing logic in the library is now rewritten to be async await. Now the problem is the event handlers in windows service. I get error when I make them async void saying it needs to be a task. I know in UI application we can make async void. Is it not allowed in windows services? Also say I make it async void, then I have the problem of handling exception as they won't be caught there since there is no task. I also need to consider if there are any implications w.r.t SynchronizationContext as Win Services have the default context anyway and event handlers capture the context when async.</p>