Problems firing events in a remote object
I've created a .Net remoting singleton object and am trying to get it to raise events that the client can sunbsribe to. The object needs to be completely independent of the clients so I have used an interface rather than copying the object's assembly to each client.
I have successfully manged to get the client to subscribe but unfortunately am left with the problem that the object won't raise the events.
I have defined a deligate like this (outside of any classes):
[Serializable]
public delegate void MyHandler();
I have defined the event in both the remote object class and the interface:
public event MyHandler MyEvent;
Finally I have a mthod to raise the event:
protected virtual void OnMyEvent()
{
if (MyEvent != null)
{
MyEvent();
}
}
When having troubles I added tracing. it turns out that the OnMyEvent method is called but the if statement always returns false and the event is not raised.
Anyone any thoughts as to why?