Skip to content

GUID interop: ref vs [MarshalAs(UnmanagedType.LPStruct)] is confusing #45785

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

Open
s341507 opened this issue Apr 11, 2025 · 0 comments
Open

GUID interop: ref vs [MarshalAs(UnmanagedType.LPStruct)] is confusing #45785

s341507 opened this issue Apr 11, 2025 · 0 comments

Comments

@s341507
Copy link

s341507 commented Apr 11, 2025

Type of issue

Typo

Description

Current wording

"❌ DON'T Use [MarshalAs(UnmanagedType.LPStruct)] for anything other than ref GUID parameters."

This does not make sense, when reading the paragraph above that says "place either a ref keyword or a [MarshalAs(UnmanagedType.LPStruct)] attribute on the GUID parameter declaration"

Paragraph above current wording

"GUIDs are usable directly in signatures. Many Windows APIs take GUID& type aliases like REFIID. When the method signature contains a reference parameter, place either a ref keyword or a [MarshalAs(UnmanagedType.LPStruct)] attribute on the GUID parameter declaration."

Page URL

https://learn.microsoft.com/en-us/dotnet/standard/native-interop/best-practices#guids

Content source URL

https://github.com/dotnet/docs/blob/main/docs/standard/native-interop/best-practices.md

Document Version Independent Id

e58f3d16-8083-0efe-0057-e21dbebb262f

Platform Id

87721c9b-7c82-1598-5dfd-21d35f0beec8

Article author

@jkoritzinsky

Metadata

  • ID: 6ea501d3-d963-c5dc-342d-ee82c92d1850
  • PlatformId: 87721c9b-7c82-1598-5dfd-21d35f0beec8
  • Service: dotnet-fundamentals

Related Issues

@dotnet-policy-service dotnet-policy-service bot added the ⌚ Not Triaged Not triaged label Apr 11, 2025
@s341507 s341507 changed the title GUID interop ref vs [MarshalAs(UnmanagedType.LPStruct)] is confusing GUID interop: ref vs [MarshalAs(UnmanagedType.LPStruct)] is confusing Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant