NET_4_0 is always defined now, so the ifdefs are redundant.
I verified the libs are exactly the same after this change, so this is effectively a no-op.
Fixes: http://bugzilla.xamarin.com/show_bug.cgi?id=1164
The breakage reported in #1164 was caused by commit 106fdeb4, which
fixed bxc206. The problem is that in fixing bxc206, response messages
of a type having a MessageContractAttribute custom attribute were
changed to have a `void` return type, according to the
MessageDescription's Body.ReturnValue.Type property.
This fix is correct, in that it's what .NET does, but it broke XML
deserialization which expected the "actual" return type to exist, not
`void`.
Case in point: the added IService1.EndJSMGetDatabases() method will
have a MessageDescription with a Body.ReturnValue.Type=typeof(void).
The problem is that deserializing this message will fail:
System.Runtime.Serialization.SerializationException: Deserializing
type 'System.Void'. Expecting state 'EndElement'. Encountered state
'Text' with name '' with namespace ''.
Obviously this is not good. ;-)
The fix is simple: don't use the MessageDescription's ReturnValue if
it's `typeof(void)`.
There are two added wrinkles:
1. Writing a test case for the above.
2. The test case broke with another error: a NRE within
BaseMessagesFormatter.MessageObjectToParts(). This is because
when ContractDescriptionGenerator.GetMessage() sets the
ReturnValue for a response message, it doesn't set
MessagePartDescription.MemberInfo.
BaseMessagesFormatter.MessageObjectToParts(), meanwhile, was
checking the ReturnValue's MemberInfo...which was null.
Add a null check here so that the actual bug can be tested.
For reasons I currently can't explain, the Service1Client test type
appears to support having only one async operation "in flight" at a
time. As a result of this, calling multiple Async methods on the
Service1Client instance, as was done previously, would result in not
all of the event handlers being invoked, and the test timing out
after 60s instead of exiting quickly because all event handlers had
been raised.
I don't understand enough of WCF & this code to say why Service1Client
can have only one async operation in progress at once, but making this
change so that each async operation operates on a separate instance
speeds up the Bug652331_2Test execution from 60s to 5s.