From ca36a6bc952e07e4b31ae7abd383455fc36c4546 Mon Sep 17 00:00:00 2001 From: NN Date: Sun, 12 Jul 2020 16:54:40 +0300 Subject: [PATCH] Fix passing non-readonly-struct by read-only reference (#147) --- Core/Extensions/InteropExtensions.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Core/Extensions/InteropExtensions.cs b/Core/Extensions/InteropExtensions.cs index 9b2e4f9f..3218aa1f 100644 --- a/Core/Extensions/InteropExtensions.cs +++ b/Core/Extensions/InteropExtensions.cs @@ -412,10 +412,9 @@ namespace Vanara.Extensions /// The interface identifier (IID) of the requested interface. /// When this method returns, contains a reference to the returned interface. /// An HRESULT that indicates the success or failure of the call. - public static int QueryInterface(object iUnk, in Guid iid, out object ppv) + public static int QueryInterface(object iUnk, Guid iid, out object ppv) { - var tmp = iid; - var hr = Marshal.QueryInterface(Marshal.GetIUnknownForObject(iUnk), ref tmp, out var ippv); + var hr = Marshal.QueryInterface(Marshal.GetIUnknownForObject(iUnk), ref iid, out var ippv); ppv = hr == 0 ? Marshal.GetObjectForIUnknown(ippv) : null; return hr; } @@ -811,4 +810,4 @@ namespace Vanara.Extensions throw new ArgumentException("Unable to convert object to its binary format."); } } -} \ No newline at end of file +}