From ef459d7e04042ddb3b97e74bc900ffbbf6564e86 Mon Sep 17 00:00:00 2001 From: EvilBeaver Date: Wed, 8 Nov 2023 13:01:29 +0300 Subject: [PATCH] =?UTF-8?q?NRE=20=D0=B2=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B5=20COM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contexts/UnmanagedCOMWrapperContext.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/ScriptEngine/Machine/Contexts/UnmanagedCOMWrapperContext.cs b/src/ScriptEngine/Machine/Contexts/UnmanagedCOMWrapperContext.cs index b9893ff1d..844eae95b 100644 --- a/src/ScriptEngine/Machine/Contexts/UnmanagedCOMWrapperContext.cs +++ b/src/ScriptEngine/Machine/Contexts/UnmanagedCOMWrapperContext.cs @@ -105,7 +105,7 @@ public override IValue GetPropValue(int propNum) var result = DispatchUtility.Invoke(Instance, dispId, null); return CreateIValue(result); } - catch (System.Reflection.TargetInvocationException e) + catch (TargetInvocationException e) { throw e.InnerException ?? e; } @@ -149,16 +149,16 @@ public override void SetPropValue(int propNum, IValue newVal) } DispatchUtility.InvokeSetProperty(Instance, dispId, argToPass); } - catch (System.Reflection.TargetInvocationException e) + catch (TargetInvocationException e) { throw e.InnerException ?? e; } } - catch (System.MissingMemberException) + catch (MissingMemberException) { throw PropertyAccessException.PropNotFoundException(prop.Name); } - catch (System.MemberAccessException) + catch (MemberAccessException) { throw PropertyAccessException.PropIsNotWritableException(prop.Name); } @@ -203,12 +203,12 @@ public override void CallAsProcedure(int methodNumber, IValue[] arguments) DispatchUtility.Invoke(Instance, dispId, argsData.values, argsData.flags); RemapOutputParams(arguments, argsData.values, argsData.flags[0], initialValues); } - catch (System.Reflection.TargetInvocationException e) + catch (TargetInvocationException e) { throw e.InnerException ?? e; } } - catch (System.MissingMemberException) + catch (MissingMemberException) { throw RuntimeException.MethodNotFoundException(method.Name); } @@ -234,12 +234,12 @@ public override void CallAsFunction(int methodNumber, IValue[] arguments, out IV RemapOutputParams(arguments, argsData.values, argsData.flags[0], initialValues); retValue = CreateIValue(result); } - catch (System.Reflection.TargetInvocationException e) + catch (TargetInvocationException e) { throw e.InnerException ?? e; } } - catch (System.MissingMemberException) + catch (MissingMemberException) { throw RuntimeException.MethodNotFoundException(method.Name); } @@ -250,7 +250,10 @@ private void RemapOutputParams(IValue[] arguments, object[] values, ParameterMod { for (int i = 0; i < arguments.Length; i++) { - if (flags[i] && !initialValues[i].Equals(values[i])) + var initialValue = initialValues[i]; + var valueAfterCall = values[i]; + + if (flags[i] && !Equals(initialValue, valueAfterCall)) { var variable = (IVariable)arguments[i]; variable.Value = CreateIValue(values[i]);