From 881db8531d6774ea4badb613d4037a127e45e6ff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 5 Oct 2022 10:56:49 -0700 Subject: [PATCH] Fix Interop.Gdi32.StartDoc p/invoke (#76582) Co-authored-by: Elinor Fung --- .../src/Interop/Windows/Interop.Gdi32.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Drawing.Common/src/Interop/Windows/Interop.Gdi32.cs b/src/libraries/System.Drawing.Common/src/Interop/Windows/Interop.Gdi32.cs index 8b754d321fa26..192cc9b591fac 100644 --- a/src/libraries/System.Drawing.Common/src/Interop/Windows/Interop.Gdi32.cs +++ b/src/libraries/System.Drawing.Common/src/Interop/Windows/Interop.Gdi32.cs @@ -52,7 +52,7 @@ internal static partial int StartDoc( #if NET7_0_OR_GREATER [MarshalUsing(typeof(HandleRefMarshaller))] #endif - HandleRef hDC, DOCINFO lpDocInfo); + HandleRef hDC, in DOCINFO lpDocInfo); [LibraryImport(Libraries.Gdi32, SetLastError = true)] internal static partial int StartPage( @@ -179,7 +179,7 @@ internal unsafe struct BITMAPINFO_FLAT [NativeMarshalling(typeof(Marshaller))] #endif [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] - internal sealed class DOCINFO + internal struct DOCINFO { internal int cbSize = 20; internal string? lpszDocName; @@ -187,6 +187,8 @@ internal sealed class DOCINFO internal string? lpszDatatype; internal int fwType; + public DOCINFO() { } + #if NET7_0_OR_GREATER [CustomMarshaller(typeof(DOCINFO), MarshalMode.ManagedToUnmanagedIn, typeof(Marshaller))] public static class Marshaller