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
LoadResource generates an unexpected GlobalFreeSafeHandle #1622
Comments
The documentation for this function explicitly calls out that the return value should not be passed to I believe the metadata may have a way to attribute a particular return value with special release handling (in this case, none at all.) I'll move this to the win32metadata repo so we can apply an attribute to this particular method's return value and go from there. |
We have a |
We also have |
Can you define a wholly new handle type for LoadResource and LockResource? To minimise confusion if the HGLOBAL used in the headers is not actually valid for any other functions. |
Generally we try to avoid changing the type from what's declared in the headers. HGLOBAL is true to the headers. |
I agree with annotating the (For those curious, |
I'm curious about the semantic difference between the two attributes myself. If there really isn't one, I support consolidating as @riverar proposed. |
|
Reviewing that discussion, it seems to confirm |
Is there a scenario where you would own a handle but still shouldn't free it? If the semantic distinction is important, then the two attributes make sense. Otherwise, we can consolidate on one. |
No, I can't think of any case where we need distinct concepts for ownership and the need to release a handle. |
Agreed. |
Actual behavior
Expected behavior
One of the following:
GlobalFreeSafeHandle
GlobalFreeSafeHandle
withownsHandle: false
Repro steps
NativeMethods.txt
content:NativeMethods.json
content (if present):Context
0.3.18-beta
netstandard2.0
LangVersion
(if explicitly set by project):preview
The text was updated successfully, but these errors were encountered: