Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Implement RuntimeHelpers.Box - #100561

#100561
Merged
jkoritzinsky merged 12 commits into
dotnet:maindotnet/runtime:mainfrom
jkoritzinsky:boxjkoritzinsky/runtime:boxCopy head branch name to clipboard
Apr 6, 2024
Merged

Implement RuntimeHelpers.Box#100561
jkoritzinsky merged 12 commits into
dotnet:maindotnet/runtime:mainfrom
jkoritzinsky:boxjkoritzinsky/runtime:boxCopy head branch name to clipboard

Conversation

@jkoritzinsky

Copy link
Copy Markdown
Member

Fixes #97341

Implement RuntimeHelpers.Box with the same semantics as the box IL instruction. It creates a new box for value types, returns the existing object for reference types, and throws for byref types and pointers. It also throws a NullReferenceException when boxing a null by-ref (matching CoreCLR's existing behavior).

@ghost

ghost commented Apr 2, 2024

Copy link
Copy Markdown

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Comment thread src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs Outdated
Comment thread src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs Outdated
@jkoritzinsky
jkoritzinsky requested a review from jkotas April 5, 2024 17:16

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

@jkoritzinsky
jkoritzinsky merged commit 7c4fc07 into dotnet:main Apr 6, 2024
@jkoritzinsky
jkoritzinsky deleted the box branch April 6, 2024 03:17
matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API Proposal]: RuntimeHelpers.Box to create a box around a dynamically-typed byref

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.