diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
index 11ca7cec9d698..b4f415a1429d9 100644
--- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
+++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
@@ -266,6 +266,7 @@
+
diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/UnscopedRefAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/UnscopedRefAttribute.cs
new file mode 100644
index 0000000000000..cb38703a6354c
--- /dev/null
+++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/UnscopedRefAttribute.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+namespace System.Diagnostics.CodeAnalysis
+{
+ ///
+ /// Used to indicate a byref escapes and is not scoped.
+ ///
+ ///
+ ///
+ /// There are several cases where the C# compiler treats a as implicitly
+ /// - where the compiler does not allow the to escape the method.
+ ///
+ ///
+ /// For example:
+ ///
+ /// - for instance methods.
+ /// - parameters that refer to types.
+ /// - parameters.
+ ///
+ ///
+ ///
+ /// This attribute is used in those instances where the should be allowed to escape.
+ ///
+ ///
+ /// Applying this attribute, in any form, has impact on consumers of the applicable API. It is necessary for
+ /// API authors to understand the lifetime implications of applying this attribute and how it may impact their users.
+ ///
+ ///
+ [AttributeUsageAttribute(
+ AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter,
+ AllowMultiple = false,
+ Inherited = false)]
+ public sealed class UnscopedRefAttribute : Attribute
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public UnscopedRefAttribute() { }
+ }
+}
diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs
index f0425a2bf00c2..a0f6b84c1e377 100644
--- a/src/libraries/System.Runtime/ref/System.Runtime.cs
+++ b/src/libraries/System.Runtime/ref/System.Runtime.cs
@@ -8299,6 +8299,11 @@ public sealed partial class NotNullWhenAttribute : System.Attribute
public NotNullWhenAttribute(bool returnValue) { }
public bool ReturnValue { get { throw null; } }
}
+ [System.AttributeUsageAttribute(System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
+ public sealed class UnscopedRefAttribute : System.Attribute
+ {
+ public UnscopedRefAttribute() { }
+ }
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false, AllowMultiple=false)]
public sealed partial class RequiresAssemblyFilesAttribute : System.Attribute
{