A while ago I talked a bit about Windows Communication Foundation's IParameterInspector extensibility and how it was affected by One-Way operations on the server and client side. Just so you're aware, the IClientMessageInspector has the same issues as IParameterInspector on the client side; that is, the AfterReceiveReply() method will never be called for OneWay methods.
I'm working currently on implementing client-side proxy instrumentation in WCF for QuickCounters, and to work around this limitation, here's what I'm currently doing:
- While constructing my IClientMessageInspector implementation, I build a map of operations from the endpoint ContractDescription (which I get from the IEndpointBehavior implementation). Here I take note of which operations are OneWay.
- When BeforeSendRequest() is called, I check the operations map, and if it is a message for a OneWay operation, then I immediate free the necessary resources, to avoid leaking them because AfterReceiveReply() won't be called.
This does imply that instrumentation for one-way operations on the client side will be a little weaker (certainly more so than for the server side), but it will stll be useful and reduced functionality was expected anyway because the client side has no way to detect faults, for example.