Skip to content

Commit 43b1ce5

Browse files
authored
Allow more efficient marshalling to IDispatch (dotnet#53065)
In NativeAOT scenario this allow to not rely on reflection to get GUID of the IDispatch, since it is well known. Related to dotnet/runtimelab#1142
1 parent c1ed0db commit 43b1ce5

File tree

1 file changed

+2
-2
lines changed
  • src/libraries/Common/src/System/Runtime/InteropServices

1 file changed

+2
-2
lines changed

src/libraries/Common/src/System/Runtime/InteropServices/Variant.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public unsafe void CopyFromIndirect(object value)
202202
break;
203203

204204
case VarEnum.VT_DISPATCH:
205-
*(IntPtr*)this._typeUnion._unionTypes._byref = Marshal.GetComInterfaceForObject<object, IDispatch>(value);
205+
*(IntPtr*)this._typeUnion._unionTypes._byref = Marshal.GetIDispatchForObject(value);
206206
break;
207207

208208
case VarEnum.VT_BSTR:
@@ -698,7 +698,7 @@ public object? AsDispatch
698698
}
699699
else
700700
{
701-
_typeUnion._unionTypes._dispatch = Marshal.GetComInterfaceForObject<object, IDispatch>(value);
701+
_typeUnion._unionTypes._dispatch = Marshal.GetIDispatchForObject(value);
702702
}
703703
}
704704
}

0 commit comments

Comments
 (0)