Skip to content

Commit

Permalink
Allow more efficient marshalling to IDispatch (#53065)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kant2002 committed May 21, 2021
1 parent c1ed0db commit 43b1ce5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public unsafe void CopyFromIndirect(object value)
break;

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

case VarEnum.VT_BSTR:
Expand Down Expand Up @@ -698,7 +698,7 @@ public object? AsDispatch
}
else
{
_typeUnion._unionTypes._dispatch = Marshal.GetComInterfaceForObject<object, IDispatch>(value);
_typeUnion._unionTypes._dispatch = Marshal.GetIDispatchForObject(value);
}
}
}
Expand Down

0 comments on commit 43b1ce5

Please sign in to comment.