There was apparently no point in the call flow when the reponse message was set
in the context, resulting in WebOperationContext.IncomingResponse always being
null.
After patching WebMessageFormatter to set the response in the context (if
available) the value of WebOperationContext.IncomingResponse was still null. A
bit more investigation showed that IncomingWebResponseContext would construct a
HttpResponseMessageProperty encapsulating the OperationContext at the time the
request was made but before the response was received and cache that object.
That caused the HttpResponseMessageProperty to always have a null value for the
response. The second part of the patch changes this behavior and always creates
a new HttpResponseMessageProperty on GET.
OutgoingWebRequestContext throws a NullReferenceException when making a REST
call. The exception is thrown because there are no Headers in the context.
Attached patch simply tests for null before copying values from Headers.
* WebOperationContext.cs : Current is automatically created (even
without WebHttpBehavior or WebChannelFactory).
* IncomingWebRequestContext.cs, IncomingWebResponseContext.cs:
WebOperationContext could be created regardless of whether it is
request or not. So do not premise incoming members existence.
* WebOperationContextTest.cs : new test.
* WebInvokeAttributeTest.cs : new test, not working.
* System.ServiceModel.Web_test.dll.sources :
added WebOperationContextTest.cs.
svn path=/trunk/mcs/; revision=141005