-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Unsafe.NullRef<T> and IsNullRef<T> are missing from the public APIs #38785
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
The implementation in corelib is for internal use only in corelib. It's often augmented first, as it doesn't have the same bar as for public API. Exposing these publicly is tracked by #31170. Thanks. |
Oof, my bad, completely missed that duplicate issue. Thanks! 😊 |
No worries :) |
API proposal #31170 was approved. @Sergio0694 Are you interested in submitting PR with the implementation? |
Summary
There are two new
Unsafe
APIs that have been added to CoreCLR recently:Unsafe.NullRef<T>
andUnsafe.IsNullRef<T>
, but they're not publicly available (tested this both on just .NET 5 Preview 6, and from theSystem.Runtime.CompilerServices.Unsafe
packages, latest version as well). The comments say this file should be kept in sync with the publicUnsafe.il
file with the APIs that are available outside of CoreCLR, but these two are currently missing. Is this just an oversight or was it on purpose?These are the two APIs in question:
runtime/src/libraries/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/Unsafe.cs
Lines 377 to 390 in 4fb2a68
runtime/src/libraries/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/Unsafe.cs
Lines 392 to 410 in 4fb2a68
They'd extremely useful to have, especially because working around them is quite verbose (in particular
IsNullRef
), and most importantly because it forces you to have anunsafe
block, since you have to go through a pointer to implement these two.Having these two publicly available would be super handy! 😄
The text was updated successfully, but these errors were encountered: