diff --git a/src/libraries/Common/src/System/Runtime/InteropServices/Variant.cs b/src/libraries/Common/src/System/Runtime/InteropServices/Variant.cs index ab2210cdda15c..60e880a4ffe8c 100644 --- a/src/libraries/Common/src/System/Runtime/InteropServices/Variant.cs +++ b/src/libraries/Common/src/System/Runtime/InteropServices/Variant.cs @@ -202,7 +202,7 @@ public unsafe void CopyFromIndirect(object value) break; case VarEnum.VT_DISPATCH: - *(IntPtr*)this._typeUnion._unionTypes._byref = Marshal.GetComInterfaceForObject(value); + *(IntPtr*)this._typeUnion._unionTypes._byref = Marshal.GetIDispatchForObject(value); break; case VarEnum.VT_BSTR: @@ -698,7 +698,7 @@ public object? AsDispatch } else { - _typeUnion._unionTypes._dispatch = Marshal.GetComInterfaceForObject(value); + _typeUnion._unionTypes._dispatch = Marshal.GetIDispatchForObject(value); } } }