dotnet-api-docs
dotnet-api-docs copied to clipboard
Document `ref` return as required for field accessors in UnsafeAccessorAttribute
Summary
The documentation of UnsafeAccessorAttribute incorrectly suggests the ref return is optional for field accessors. Without ref you get System.BadImageFormatException: 'Invalid usage of UnsafeAccessorAttribute.'
Example accessor throwing the above exception when invoked:
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_charBuffer")]
static extern char[] GetCharBuffer(StreamReader sr);
Learn Build status updates of commit 3f91840:
:white_check_mark: Validation status: passed
| File | Status | Preview URL | Details |
|---|---|---|---|
| xml/System.Runtime.CompilerServices/UnsafeAccessorAttribute.xml | :white_check_mark:Succeeded | View |
For more details, please refer to the build report.
For any questions, please:
- Try searching the learn.microsoft.com contributor guides
- Post your question in the Learn support channel