-
Notifications
You must be signed in to change notification settings - Fork 6k
Add unsafe-code/best-practices.md #48557
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the comments I made on discord, looks good to me :)
Co-authored-by: Jan Kotas <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
@jkotas anything else here from our side? |
This needs to be reviewed and signed off by the doc maintainers before merging. It looks good to me otherwise. |
Co-authored-by: Genevieve Warren <[email protected]>
2) Replace ```cs with ```csharp 3) Add links to .NET Memory Model
@gewarren thank you so much for the corrections! I learned a lot 🙂 I believe, I've addressed all of your requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few xref fixes. I'll commit these.
@gewarren ah, thanks, I already fixed them locally (just pushed) via that extension that you recommended |
Nice, that was my hackathon project last year :) |
Awesome! It does look handy. Regarding the PR, who typically merges the PRs? |
Me or one of the other content devs (or you if you have write perms). I'll merge it now. Thanks for adding this doc! |
Thanks much! |
Here's the live link for anyone like me who was looking for it |
Summary
The document contains best practices when dealing with Unsafe code in .NET (focusing on C#), a set of common unreliable patterns and how to avoid them. Some background on why we do this is described here: dotnet/designs#341
We were using https://learn.microsoft.com/en-us/dotnet/standard/native-interop/best-practices as an inspiration for this doc.
cc @jkotas @richlander
Internal previews