未验证 提交 8ed11a24 编写于 作者: G github-actions[bot] 提交者: GitHub

Update Marshal.QueryInterface() argument modifier (#91984)

Change "in" modifier to "ref readonly" to avoid warnings
in existing interop code.
Co-authored-by: NAaron R Robinson <arobins@microsoft.com>
Co-authored-by: NCarlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
上级 834593b2
......@@ -130,7 +130,7 @@ public static int SizeOf<T>()
return SizeOfHelper(t, throwIfNotMarshalable: true);
}
public static unsafe int QueryInterface(IntPtr pUnk, in Guid iid, out IntPtr ppv)
public static unsafe int QueryInterface(IntPtr pUnk, ref readonly Guid iid, out IntPtr ppv)
{
ArgumentNullException.ThrowIfNull(pUnk);
......
......@@ -1104,7 +1104,7 @@ public static partial class Marshal
public static object? PtrToStructure(System.IntPtr ptr, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors| System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type structureType) { throw null; }
public static T? PtrToStructure<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]T>(System.IntPtr ptr) { throw null; }
public static void PtrToStructure<T>(System.IntPtr ptr, [System.Diagnostics.CodeAnalysis.DisallowNullAttribute] T structure) { }
public static int QueryInterface(System.IntPtr pUnk, in System.Guid iid, out System.IntPtr ppv) { throw null; }
public static int QueryInterface(System.IntPtr pUnk, ref readonly System.Guid iid, out System.IntPtr ppv) { throw null; }
public static byte ReadByte(System.IntPtr ptr) { throw null; }
public static byte ReadByte(System.IntPtr ptr, int ofs) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Marshalling code for the object might not be available")]
......
......@@ -32,7 +32,7 @@ public unsafe interface IIUnknownStrategy
/// <param name="iid">The IID (Interface ID) to query for.</param>
/// <param name="ppObj">The resulting interface.</param>
/// <returns>Returns an HRESULT represents the success of the operation.</returns>
/// <seealso cref="Marshal.QueryInterface(nint, in Guid, out nint)"/>
/// <seealso cref="Marshal.QueryInterface(nint, ref readonly Guid, out nint)"/>
public int QueryInterface(void* instancePtr, in Guid iid, out void* ppObj);
/// <summary>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册