Skip to content
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

Handle structs incorrectly using nint field instead of IntPtr #312

Closed
AArnott opened this issue Jun 29, 2021 · 1 comment · Fixed by #588
Closed

Handle structs incorrectly using nint field instead of IntPtr #312

AArnott opened this issue Jun 29, 2021 · 1 comment · Fixed by #588
Assignees
Labels
bug Something isn't working

Comments

@AArnott
Copy link
Member

AArnott commented Jun 29, 2021

Actual behavior

A recent regression has led to typedef structs that represent handles using nint everywhere instead of the more opaque IntPtr type.

Expected behavior

Use IntPtr for opaque, pointer-sized value (e.g. IntPtr handle)
Reserve nint for integers that code is expected to manipulate and interpret (e.g. nint Length)

Repro steps

  1. NativeMethods.txt content:
HWND
  1. NativeMethods.json content (if present):
    N/A

  2. Any of your own code that should be shared?

Context

  • CsWin32 version: 0.1.506-beta
  • Win32Metadata version (if explicitly set by project):
  • Target Framework: [e.g. netstandard2.0]
  • LangVersion (if explicitly set by project): [e.g. 9]
@AArnott AArnott added the bug Something isn't working label Jun 29, 2021
@AArnott AArnott self-assigned this Jun 16, 2022
@AArnott
Copy link
Member Author

AArnott commented Jun 16, 2022

Actually this only impacted a subset of handle types that don't use the RAIIFreeAttribute on the typedefs. We already special cased HGDIOBJ. I guess we'll also special case HWND.

AArnott added a commit that referenced this issue Jun 16, 2022
AArnott added a commit that referenced this issue Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant