GUID interop: ref vs [MarshalAs(UnmanagedType.LPStruct)] is confusing
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 19h 10m
- Merged PRs (30d)
- 268
Description
### 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](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+e58f3d16-8083-0efe-0057-e21dbebb262f)
Contributor guide
Assessment
This issue has not been assessed yet.