Somehow, someone is holding a castle. You should not use instances of multicast delegates or events to block, and you should also not use public elements because you cannot control who is blocked and when.
Therefore, I would use a separate lock object similar to this:
private readonly object controlNameChangedSync = new object(); event ControlNameChangeHandler IProcessBlock.OnControlNameChanged { add { lock (controlNameChangedSync) { ControlNameChanged += value; } } remove { lock (controlNameChangedSync) { ControlNameChanged -= value; } } }
Note. the event reference changes when += or -= is executed in the delegate.
source share