# Monday, January 23, 2006

I’ve been playing with the January CTP of WCF, and I’ve encountered what seems like a pretty major setback.  I’ve got an interface that takes a MessageContract and returns a MessageContract.  All well and good.  But then I want to use the AsyncPattern on the service side, so that my routine will get called on a different thread from the one that’s listening on the network.  So I decorate the interface like so:


    public interface IThingy



        IAsyncResult BeginSignon(ThingyRequestMessage<SignOnRequest> request, AsyncCallback cb, object state);



        ThingyResponseMessage<SignOnResponse> EndSignon(IAsyncResult ar);



Now I get an exception at runtime, which says that I can’t mix parameters and messages for the method “EndSignon”.  What it means is that if I return a MessageContract instead of a primitive type, my method has to take a MessageContract and not one or more primitive types.  OK, I get that.  But my EndSignon method is getting flagged because it takes an IAsyncResult (as it must according to the AsyncPattern) and returns a ThingyResponseMessage. 

Does this mean I can’t use MessageContracts with the AsnycPattern?  If so, LAME.  If not, then what am I missing?

SOAP | Web Services | XML | Indigo
Sunday, January 29, 2006 2:15:41 PM (Pacific Standard Time, UTC-08:00)
Sounds like a bug to me...I forwarded this on to the guys who own this feature...I'll let you know what comes out.
Sunday, January 29, 2006 9:37:41 PM (Pacific Standard Time, UTC-08:00)
Hi Patrick, can you give this a try without the [OperationContract] on your EndSignon method? We consider the Begin and End methods together as representing a single Operation, so we'll bomb out during validation if we see an [OperationContract] on and End method.
Comments are closed.