Skip to content

Update Message to avoid common casting errors#5849

Merged
JeremyKuhne merged 2 commits intodotnet:mainfrom
JeremyKuhne:safeMessage
Sep 24, 2021
Merged

Update Message to avoid common casting errors#5849
JeremyKuhne merged 2 commits intodotnet:mainfrom
JeremyKuhne:safeMessage

Conversation

@JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented Sep 23, 2021

Store PARAM and result as nint and expose internally. Add DEBUG obsoletion to flush out any usages of the IntPtr properties (and suppress in consuming projects).

Note that the Message field names are deliberately named to match the properties for easier diffing in this PR.

Other changes:

  • Add Point helpers to PARAM
  • Update some GDI handle wrappers to nint
  • Update a few other native APIs to use nint
Microsoft Reviewers: Open in CodeFlow

@JeremyKuhne JeremyKuhne requested a review from a team as a code owner September 23, 2021 21:01
@ghost ghost assigned JeremyKuhne Sep 23, 2021
Store PARAM and result as nint and expose internally. Add DEBUG obsoletion to flush out any usages of the IntPtr properties (and suppress in consuming projects).

Note that the Message field names are deliberately named to match the properties for easier diffing in this PR.

Other changes:

- Add Point helpers to PARAM
- Update some GDI handle wrappers to nint
Analyzers don't let you break the string into multiple lines due to lack of smarts in closing bracket spacing analyzer. :/
Copy link
Member

@dreddy-work dreddy-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest, LGTM.

@JeremyKuhne JeremyKuhne merged commit 80e24fd into dotnet:main Sep 24, 2021
@ghost ghost added this to the 7.0 alpha1 milestone Sep 24, 2021
@JeremyKuhne JeremyKuhne deleted the safeMessage branch September 24, 2021 21:48
Comment on lines +23 to +28
#pragma warning disable IDE1006 // Naming Styles
internal nint _Result;
internal nint _LParam;
internal nint _WParam;
internal User32.WM _Msg;
#pragma warning restore IDE1006 // Naming Styles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really find this naming convention jarring and unsettling... Can we please have it as XxxInternal instead?

RussKie added a commit to RussKie/winforms that referenced this pull request Sep 30, 2021
* Rename Message fields from '_Xyz' to 'XyzInternal`
* Rename WINFORMSDEV0001 to WFDEV001 to align with existing diagnostic IDs
RussKie added a commit that referenced this pull request Oct 6, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jan 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants