Jun 11, 2007

Deadlock with Callbacks

Per default the callback service operation invoked by the service "arrives" in the user interface thread. In a case where the callback service implementation is within the Form class this is bad news concerning deadlocks.

Responsible for this behaviour is the so-called SynchronizationContext (modified since .NET 2.0 ?).

So maybe you better disable this

[CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Single, UseSynchronizationContext = false)]

public partial class ClientForm : Form, IDeviceView, IMasterCallbackService




and synchronize back into the UI thread yourself manually.

No comments:

Post a Comment