Open AArnott opened 2 years ago
@sharwell @RyanToth3 @CyrusNajmabadi @BertanAygun Do any of you think fixing this would break your existing code?
We don't use a whole lot of event handlers in our RPC Contracts, in ServiceHub or elsewhere. After a quick search I don't see anywhere where this would affect me.
I do see however that in the AvailabilityChanged event handlers of a lot of the ServiceBroker classes that you've already overriden this behavior and done what you're describing above: https://devdiv.visualstudio.com/DevDiv/_git/DevCore/?path=src/clr/Microsoft.ServiceHub.Framework/RemoteServiceBroker.cs&version=GC3a218cd53dc99fb6e86d497bf2a475e28bd5b7c0&lineStyle=plain&line=611&lineEnd=611&lineStartColumn=157&lineEndColumn=112
I have an event handler in one of the RPC contracts I own but the only callers I know don't rely on "sender" parameter so this should be fine from my point of view as well.
Adding @tmat
The dynamic proxies generated on the client raise events with
sender
set tothis.rpc
(theJsonRpc
object behind the proxy). For a proxy holder, particularly one that has never seen theJsonRpc
object because it was created by another party, this may be unexpected.I think the proxy sending
this
as thesender
parameter is more appropriate so that someone's event handler can find the object on which the handler was added via thesender
argument.