Use non-virtual call to invoke 'family or assembly' methods on base class from PowerShell class (#7622) (#7624)

This commit is contained in:
Yuriy Kushnir
2018-08-28 22:24:06 -07:00
committed by Dongbo Wang
parent 358e8abefe
commit 165f2c9a42
2 changed files with 64 additions and 2 deletions
@@ -1230,7 +1230,7 @@ namespace System.Management.Automation
var parameterTypes = methodInfo.method.GetParameters().Select(parameter => parameter.ParameterType).ToArray();
var targetTypeMethod = invocationConstraints.MethodTargetType.GetMethod(methodInfo.method.Name, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, parameterTypes, null);
if (targetTypeMethod != null && (targetTypeMethod.IsPublic || targetTypeMethod.IsFamily))
if (targetTypeMethod != null && (targetTypeMethod.IsPublic || targetTypeMethod.IsFamily || targetTypeMethod.IsFamilyOrAssembly))
{
methodInfo = new MethodInformation(targetTypeMethod, 0);
callNonVirtually = true;