Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stebon/3.1.0/cherrypickfrommaster #4021

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eng/Versioning.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<Project>
<PropertyGroup>
<GenerateAssemblyInfo Condition="'$(GenerateAssemblyInfo)'==''">true</GenerateAssemblyInfo>
<Ship_SvcUtilXmlSerPackages Condition="'$(Ship_SvcUtilXmlSerPackages)'==''">false</Ship_SvcUtilXmlSerPackages>
<Ship_WcfPackages Condition="'$(Ship_WcfPackages)'==''">true</Ship_WcfPackages>
</PropertyGroup>

<PropertyGroup Condition="'$(GenerateAssemblyInfo)'=='true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<CLSCompliant>true</CLSCompliant>
<IsImplementationAssembly>true</IsImplementationAssembly>
<IsPackable>true</IsPackable>
<IsShipping>$(Ship_WcfPackages)</IsShipping>
</PropertyGroup>

<!-- [todo:arcade] Added this because our released S.P.SM package includes the "_BlockReflectionAttribute" but it is included not only in the UAP* assembly but also the other shipped assembly, should this only be in the binary built for uap? -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@

using System.Diagnostics.Contracts;
using System.Reflection;
using System.Runtime;
using System.ServiceModel.Description;

namespace System.ServiceModel.Channels
{
// MethodCall associates a MethodBase with the arguments to pass to it.
internal class MethodCall
{
private object[] _inArgs;

public MethodCall(object[] args)
{
Contract.Assert(args != null);
Expand All @@ -21,10 +25,44 @@ public MethodCall(MethodBase methodBase, object[] args) : this(args)
{
Contract.Assert(methodBase != null);
MethodBase = methodBase;
CreateInArgs();
}

public MethodBase MethodBase { get; private set; }

public object[] Args { get; private set; }

public object[] InArgs => _inArgs ?? Args;

private void CreateInArgs()
{
var parameters = MethodBase.GetParameters();
int inCount = 0;
foreach(var param in parameters)
{
if (ServiceReflector.FlowsIn(param))
{
inCount++;
}
}

if (inCount == Args.Length) // All parameters are InArgs so do nothing and fallback to returning Args
{
return;
}

_inArgs = new object[inCount];
int inPos = 0;
for(int argPos = 0; argPos < parameters.Length; argPos++)
{
if (ServiceReflector.FlowsIn(parameters[argPos]))
{
_inArgs[inPos] = Args[argPos];
inPos++;
}
}

Fx.Assert((inPos - 1) != (inCount), $"Incorrect number of arguments put into _inArgs array, expected {inCount} and copied {inPos - 1}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ public static Task CreateTask(ServiceChannel channel, MethodCall methodCall, Pro
{
if (operation.TaskTResult == ServiceReflector.VoidType)
{
return TaskCreator.CreateTask(channel, operation, methodCall.Args);
return TaskCreator.CreateTask(channel, operation, methodCall.InArgs);
}
return TaskCreator.CreateGenericTask(channel, operation, methodCall.Args);
return TaskCreator.CreateGenericTask(channel, operation, methodCall.InArgs);
}

private static Task CreateGenericTask(ServiceChannel channel, ProxyOperationRuntime operation, object[] inputParameters)
Expand Down
Loading