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-31 16:55:42 -07:00
committed by Travis Plunk
parent 28c59a2a57
commit d8bb2e9028
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;