Quote Originally Posted by jmcilhinney View Post
The point of the SynchronizationContext is to be able to marshal a method call to the UI thread in order to update the UI. There's no UI in a Windows Service so there's no need to update anything specifically on the UI thread, therefore there's no need for the SynchronizationContext. It only works in Windows Forms and WPF applications because those are the only applications that need to use it. In a Windows Service you will still need to synchronise multiple threads such that they don't interfere with each other but there's no need to perform any particular operation on any particular thread.
Thanks you jmcilhinney for your answer and time. I understand this and i try explain to you. I want the server to be a service because I'm using it to send notification messages to clients (as messenger). The client has a graphical interface. The problem is that when a client connects to the server, the service drop me a NullException, as the context for the service is null. I tried to work without this class, but then the server not notify to customers. Any idea?