Skip to content

Refactor buffer examples to improve safety#54669

Open
AaronRobinsonMSFT wants to merge 1 commit into
mainfrom
AaronRobinsonMSFT-patch-1
Open

Refactor buffer examples to improve safety#54669
AaronRobinsonMSFT wants to merge 1 commit into
mainfrom
AaronRobinsonMSFT-patch-1

Conversation

@AaronRobinsonMSFT

@AaronRobinsonMSFT AaronRobinsonMSFT commented Jul 7, 2026

Copy link
Copy Markdown
Member

Missed feedback from #50898


Internal previews

📄 File 🔗 Preview link
docs/standard/native-interop/customize-struct-marshalling.md Customize structure marshalling

Updated examples to use classes instead of structs for buffer management and added InlineArrayAttribute for safe buffer usage.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the fixed-size buffer examples in customize-struct-marshalling.md to improve safety guidance around StructLayoutAttribute.Size and to steer readers toward InlineArrayAttribute.

Changes:

  • Renamed the “unsafe” and “safe” example types.
  • Moved the InlineArray buffer type into a nested type inside the safe example.
  • Switched the examples from struct to class (as currently written in the diff).
Show a summary per file
File Description
docs/standard/native-interop/customize-struct-marshalling.md Updates the fixed-size buffer examples intended to demonstrate unsafe StructLayoutAttribute.Size usage and the safer InlineArrayAttribute alternative.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment thread docs/standard/native-interop/customize-struct-marshalling.md
Comment thread docs/standard/native-interop/customize-struct-marshalling.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants