Imported Upstream version 5.16.0.100

Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-07 15:19:03 +00:00
parent 0a9828183b
commit 7d7f676260
4419 changed files with 170950 additions and 90273 deletions

View File

@ -70,17 +70,14 @@ namespace System.ServiceModel.Dispatcher
internal static void Validate (OperationDescription od, bool isRpc, bool isEncoded)
{
bool hasParameter = false, hasVoid = false;
bool hasVoid = false;
foreach (var md in od.Messages) {
if (md.IsTypedMessage || md.IsUntypedMessage) {
if (isRpc && !isEncoded)
throw new InvalidOperationException ("Message with action {0} is either strongly-typed or untyped, but defined as RPC and encoded.");
if (hasParameter && !md.IsVoid)
throw new InvalidOperationException (String.Format ("Operation '{0}' contains a message with parameters. Strongly-typed or untyped message can be paired only with strongly-typed, untyped or void message.", od.Name));
if (isRpc && hasVoid)
throw new InvalidOperationException (String.Format ("This operation '{0}' is defined as RPC and contains a message with void, which is not allowed.", od.Name));
} else {
hasParameter |= !md.IsVoid;
hasVoid |= md.IsVoid;
}
}

View File

@ -356,9 +356,12 @@ namespace System.ServiceModel.Dispatcher
owner.Listener.Open (openTimeout);
// It is tested at Open(), but strangely it is not instantiated at this point.
foreach (var ed in owner.Endpoints)
if (ed.DispatchRuntime.InstanceContextProvider == null && (ed.DispatchRuntime.Type == null || ed.DispatchRuntime.Type.GetConstructor (Type.EmptyTypes) == null))
foreach (var ed in owner.Endpoints) {
if ((ed.DispatchRuntime.InstanceProvider == null && ed.DispatchRuntime.InstanceContextProvider == null)
&& (ed.DispatchRuntime.Type == null || ed.DispatchRuntime.Type.GetConstructor (Type.EmptyTypes) == null)) {
throw new InvalidOperationException ("There is no default constructor for the service Type in the DispatchRuntime");
}
}
SetupChannelAcceptor ();
}
@ -623,9 +626,8 @@ namespace System.ServiceModel.Dispatcher
} finally {
if (rc != null)
rc.Close ();
// unless it is closed by session/call manager, move it back to the loop to receive the next message.
if (loop && reply.State != CommunicationState.Closed)
ProcessRequestOrInput (reply);
reply.Close (owner.DefaultCloseTimeout); // close the channel
}
}