-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add PD and PD_RESULT enums in Interop Comdlg32 #2594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8a7e4df
to
cf484bf
Compare
Codecov Report
@@ Coverage Diff @@
## master #2594 +/- ##
==================================================
+ Coverage 57.02795% 57.04975% +0.0218%
==================================================
Files 1440 1440
Lines 417476 417476
Branches 39004 39004
==================================================
+ Hits 238078 238169 +91
+ Misses 174011 173933 -78
+ Partials 5387 5374 -13
|
src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintDialog.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintDialog.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintDialog.cs
Outdated
Show resolved
Hide resolved
@gpetrou have you tested the functionality to confirm the print dialog was shown? |
@RussKie sorry about that. If I remember correctly, I had only tested the changes before modifying the flags to use Comdlg32.PD. I shouldn't have changed the order of class items. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
highlighting potential interop mistakes for #2814
IntPtr m_hDevNames; | ||
IntPtr m_hDC; | ||
|
||
int m_Flags; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fields cannot be moved around
public IntPtr hDevNames { get { return m_hDevNames; } set { m_hDevNames = value; } } | ||
public IntPtr hDC { get { return m_hDC; } set { m_hDC = value; } } | ||
|
||
public int Flags { get { return m_Flags; } set { m_Flags = value; } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
automatic properties must be avoided in interop since you don't control the binary layout anymore
[edit] made the comment on the wrong side of the diff, this line got replaced by an automatic property public int Flags { get; set; }
which is what I was talking about above.
IntPtr m_hDevNames; | ||
IntPtr m_hDC; | ||
|
||
int m_Flags; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fields cannot be moved around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, should have picked that! 🤦♂
public IntPtr hDevNames { get { return m_hDevNames; } set { m_hDevNames = value; } } | ||
public IntPtr hDC { get { return m_hDC; } set { m_hDC = value; } } | ||
|
||
public int Flags { get { return m_Flags; } set { m_Flags = value; } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use automatic properties since you cannot control the binary layout
[edit] made the comment on the wrong side of the diff, this line got replaced by an automatic property public int Flags { get; set; }
which is what I was talking about above.
Resolves dotnet#2814 The bug was caused by the conversion of a struct fields to auto-properties in dotnet#2594. This broke the interop binary layout. Rework the code to - correctly define x86 and x64 structs - make the structs blittable - add tests verifying the structs layouts
Resolves dotnet#2814 The bug was caused by the conversion of a struct fields to auto-properties in dotnet#2594. This broke the interop binary layout. Rework the code to - correctly define x86 and x64 structs - make the structs blittable - add tests verifying the structs layouts
Proposed changes
Microsoft Reviewers: Open in CodeFlow