Add missing compiler-generated attributes to corelib (#87857)
authorStephen Toub <stoub@microsoft.com>
Fri, 7 Jul 2023 00:47:13 +0000 (20:47 -0400)
committerGitHub <noreply@github.com>
Fri, 7 Jul 2023 00:47:13 +0000 (17:47 -0700)
* Add IsUnmanaged, ScopedRef, and Nullable{Context/PublicOnly} attributes

* Update attributes and add docs / tests

* Skip test expecting NullableContextAttribute to be partially trimmed

* Update Moq to latest

* Preserve metadata for InterfaceMethodWithoutTargetInvocation

* Preserve metadata for InheritanceInvocationWithoutTarget

---------

Co-authored-by: Eric StJohn <ericstj@microsoft.com>
16 files changed:
eng/Versions.props
eng/testing/ILLinkDescriptors/ILLink.Descriptors.Castle.xml
src/libraries/System.ComponentModel.TypeConverter/tests/ILLink.Descriptors.xml
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/IsByRefLikeAttribute.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/IsReadOnlyAttribute.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/IsUnmanagedAttribute.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/NullableAttribute.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/NullableContextAttribute.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/NullablePublicOnlyAttribute.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RefSafetyRulesAttribute.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RequiredMemberAttribute.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/ScopedRefAttribute.cs [new file with mode: 0644]
src/libraries/System.Runtime/ref/System.Runtime.cs
src/libraries/System.Runtime/tests/System/Runtime/CompilerServices/AttributesTests.cs
src/libraries/System.Text.Json/tests/Common/UnsupportedTypesTests.cs

index 5da75ea..0217d8e 100644 (file)
     <NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
     <NewtonsoftJsonBsonVersion>1.0.2</NewtonsoftJsonBsonVersion>
     <SQLitePCLRawbundle_greenVersion>2.0.4</SQLitePCLRawbundle_greenVersion>
-    <MoqVersion>4.12.0</MoqVersion>
+    <MoqVersion>4.18.4</MoqVersion>
     <FluentAssertionsVersion>6.7.0</FluentAssertionsVersion>
     <FsCheckVersion>2.14.3</FsCheckVersion>
     <!-- Android gRPC client tests -->
index 7a8084b..cd75bd5 100644 (file)
@@ -3,6 +3,8 @@
     <namespace fullname="Castle.DynamicProxy" />
     <type fullname="Castle.DynamicProxy.Internal.CompositionInvocation" />
     <type fullname="Castle.DynamicProxy.Internal.InheritanceInvocation" />
+    <type fullname="Castle.DynamicProxy.Internal.InheritanceInvocationWithoutTarget" />
+    <type fullname="Castle.DynamicProxy.Internal.InterfaceMethodWithoutTargetInvocation" />
   </assembly>
   <assembly fullname="Moq">
     <type fullname="Moq.Internals.InterfaceProxy">
index 6bc544a..85f6b38 100644 (file)
@@ -9,6 +9,8 @@
       <namespace fullname="Castle.DynamicProxy" />
       <type fullname="Castle.DynamicProxy.Internal.CompositionInvocation" />
       <type fullname="Castle.DynamicProxy.Internal.InheritanceInvocation" />
+      <type fullname="Castle.DynamicProxy.Internal.InheritanceInvocationWithoutTarget" />
+      <type fullname="Castle.DynamicProxy.Internal.InterfaceMethodWithoutTargetInvocation" />
   </assembly>
   <assembly fullname="Moq">
       <type fullname="Moq.Internals.InterfaceProxy">
index 697654c..439ee87 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\InterpolatedStringHandlerAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\InterpolatedStringHandlerArgumentAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\DefaultInterpolatedStringHandler.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\IsUnmanagedAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\IteratorStateMachineAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ITuple.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\LoadHint.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\MethodImplOptions.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ModuleInitializerAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\MetadataUpdateOriginalTypeAttribute.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\NullableAttribute.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\NullableContextAttribute.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\NullablePublicOnlyAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ReferenceAssemblyAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\PoolingAsyncValueTaskMethodBuilder.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\PoolingAsyncValueTaskMethodBuilderT.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RuntimeFeature.NonNativeAot.cs" Condition="'$(FeatureNativeAot)' != 'true'" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RuntimeHelpers.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RuntimeWrappedException.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ScopedRefAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\SkipLocalsInitAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\SpecialNameAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\StateMachineAttribute.cs" />
index e24941d..a92c8fc 100644 (file)
@@ -6,13 +6,14 @@ using System.ComponentModel;
 namespace System.Runtime.CompilerServices
 {
     /// <summary>
-    /// Reserved to be used by the compiler for tracking metadata.
+    /// Reserved for use by a compiler for tracking metadata.
     /// This attribute should not be used by developers in source code.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
     [AttributeUsage(AttributeTargets.Struct)]
     public sealed class IsByRefLikeAttribute : Attribute
     {
+        /// <summary>Initializes the attribute.</summary>
         public IsByRefLikeAttribute()
         {
         }
index 874d11c..ec75167 100644 (file)
@@ -6,13 +6,14 @@ using System.ComponentModel;
 namespace System.Runtime.CompilerServices
 {
     /// <summary>
-    /// Reserved to be used by the compiler for tracking metadata.
+    /// Reserved for use by a compiler for tracking metadata.
     /// This attribute should not be used by developers in source code.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
     [AttributeUsage(AttributeTargets.All, Inherited = false)]
     public sealed class IsReadOnlyAttribute : Attribute
     {
+        /// <summary>Initializes the attribute.</summary>
         public IsReadOnlyAttribute()
         {
         }
diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/IsUnmanagedAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/IsUnmanagedAttribute.cs
new file mode 100644 (file)
index 0000000..f0aeb6d
--- /dev/null
@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.ComponentModel;
+
+namespace System.Runtime.CompilerServices
+{
+    /// <summary>
+    /// Reserved for use by a compiler for tracking metadata.
+    /// This attribute should not be used by developers in source code.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    [AttributeUsage(AttributeTargets.All)]
+    public sealed class IsUnmanagedAttribute : Attribute
+    {
+        /// <summary>Initializes the attribute.</summary>
+        public IsUnmanagedAttribute()
+        {
+        }
+    }
+}
diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/NullableAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/NullableAttribute.cs
new file mode 100644 (file)
index 0000000..8b6e713
--- /dev/null
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.ComponentModel;
+
+namespace System.Runtime.CompilerServices
+{
+    /// <summary>
+    /// Reserved for use by a compiler for tracking metadata.
+    /// This attribute should not be used by developers in source code.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
+    public sealed class NullableAttribute : Attribute
+    {
+        /// <summary>Flags specifying metadata related to nullable reference types.</summary>
+        public readonly byte[] NullableFlags;
+
+        /// <summary>Initializes the attribute.</summary>
+        /// <param name="value">The flags value.</param>
+        public NullableAttribute(byte value)
+        {
+            NullableFlags = new[] { value };
+        }
+
+        /// <summary>Initializes the attribute.</summary>
+        /// <param name="value">The flags value.</param>
+        public NullableAttribute(byte[] value)
+        {
+            NullableFlags = value;
+        }
+    }
+}
diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/NullableContextAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/NullableContextAttribute.cs
new file mode 100644 (file)
index 0000000..8f4140f
--- /dev/null
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.ComponentModel;
+
+namespace System.Runtime.CompilerServices
+{
+    /// <summary>
+    /// Reserved for use by a compiler for tracking metadata.
+    /// This attribute should not be used by developers in source code.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
+    public sealed class NullableContextAttribute : Attribute
+    {
+        /// <summary>Flag specifying metadata related to nullable reference types.</summary>
+        public readonly byte Flag;
+
+        /// <summary>Initializes the attribute.</summary>
+        /// <param name="value">The flag value.</param>
+        public NullableContextAttribute(byte value)
+        {
+            Flag = value;
+        }
+    }
+}
diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/NullablePublicOnlyAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/NullablePublicOnlyAttribute.cs
new file mode 100644 (file)
index 0000000..7abb7c2
--- /dev/null
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.ComponentModel;
+
+namespace System.Runtime.CompilerServices
+{
+    /// <summary>
+    /// Reserved for use by a compiler for tracking metadata.
+    /// This attribute should not be used by developers in source code.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    [AttributeUsage(AttributeTargets.Module, Inherited = false)]
+    public sealed class NullablePublicOnlyAttribute : Attribute
+    {
+        /// <summary>Indicates whether metadata for internal members is included.</summary>
+        public readonly bool IncludesInternals;
+
+        /// <summary>Initializes the attribute.</summary>
+        /// <param name="value">Indicates whether metadata for internal members is included.</param>
+        public NullablePublicOnlyAttribute(bool value)
+        {
+            IncludesInternals = value;
+        }
+    }
+}
index 8b65250..1d11731 100644 (file)
@@ -1,10 +1,13 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
+using System.ComponentModel;
+
 namespace System.Runtime.CompilerServices
 {
     /// <summary>Indicates the language version of the ref safety rules used when the module was compiled.</summary>
-    [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    [AttributeUsage(AttributeTargets.Module, Inherited = false)]
     public sealed class RefSafetyRulesAttribute : Attribute
     {
         /// <summary>Initializes a new instance of the <see cref="RefSafetyRulesAttribute"/> class.</summary>
index 4a17cfc..f03116d 100644 (file)
@@ -1,10 +1,13 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
+using System.ComponentModel;
+
 namespace System.Runtime.CompilerServices
 {
     /// <summary>Specifies that a type has required members or that a member is required.</summary>
     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
+    [EditorBrowsable(EditorBrowsableState.Never)]
 #if SYSTEM_PRIVATE_CORELIB
     public
 #else
diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/ScopedRefAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/ScopedRefAttribute.cs
new file mode 100644 (file)
index 0000000..4ca4131
--- /dev/null
@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.ComponentModel;
+
+namespace System.Runtime.CompilerServices
+{
+    /// <summary>
+    /// Reserved for use by a compiler for tracking metadata.
+    /// This attribute should not be used by developers in source code.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    [AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
+    public sealed class ScopedRefAttribute : Attribute
+    {
+        /// <summary>Initializes the attribute.</summary>
+        public ScopedRefAttribute()
+        {
+        }
+    }
+}
index 4bd5bab..dbd41d3 100644 (file)
@@ -8284,7 +8284,7 @@ namespace System.Diagnostics.CodeAnalysis
         public ExcludeFromCodeCoverageAttribute() { }
         public string? Justification { get { throw null; } set { } }
     }
-    [System.AttributeUsage(System.AttributeTargets.Assembly |  System.AttributeTargets.Module | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, Inherited = false)]
+    [System.AttributeUsageAttribute(System.AttributeTargets.Assembly |  System.AttributeTargets.Module | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, Inherited = false)]
     public sealed class ExperimentalAttribute : System.Attribute
     {
         public ExperimentalAttribute(string diagnosticId) { }
@@ -8361,7 +8361,7 @@ namespace System.Diagnostics.CodeAnalysis
         public string Message { get { throw null; } }
         public string? Url { get { throw null; } set { } }
     }
-    [System.AttributeUsage(System.AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
+    [System.AttributeUsageAttribute(System.AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
     public sealed class SetsRequiredMembersAttribute : System.Attribute
     {
         public SetsRequiredMembersAttribute() { }
@@ -12752,7 +12752,7 @@ namespace System.Runtime.CompilerServices
     {
         public InterpolatedStringHandlerAttribute() { }
     }
-    [AttributeUsage(System.AttributeTargets.Struct, AllowMultiple = false)]
+    [System.AttributeUsageAttribute(System.AttributeTargets.Struct, AllowMultiple = false)]
     [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
     public sealed partial class InlineArrayAttribute : System.Attribute
     {
@@ -12782,6 +12782,11 @@ namespace System.Runtime.CompilerServices
     {
         object? Value { get; set; }
     }
+    [System.AttributeUsageAttribute(System.AttributeTargets.All)]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+    public sealed partial class IsUnmanagedAttribute : Attribute
+    {
+    }
     public static partial class IsVolatile
     {
     }
@@ -12835,6 +12840,29 @@ namespace System.Runtime.CompilerServices
     {
         public ModuleInitializerAttribute() { }
     }
+    [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Parameter | System.AttributeTargets.ReturnValue | System.AttributeTargets.GenericParameter, Inherited = false)]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+    public sealed partial class NullableAttribute : Attribute
+    {
+        public readonly byte[] NullableFlags;
+        public NullableAttribute(byte value) { }
+
+        public NullableAttribute(byte[] value) { }
+    }
+    [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Method | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, Inherited = false)]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+    public sealed partial class NullableContextAttribute : Attribute
+    {
+        public readonly byte Flag;
+        public NullableContextAttribute(byte value) { }
+    }
+    [System.AttributeUsageAttribute(System.AttributeTargets.Module, Inherited = false)]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+    public sealed partial class NullablePublicOnlyAttribute : Attribute
+    {
+        public readonly bool IncludesInternals;
+        public NullablePublicOnlyAttribute(bool value) { }
+    }
     public partial struct PoolingAsyncValueTaskMethodBuilder
     {
         private object _dummy;
@@ -12867,13 +12895,15 @@ namespace System.Runtime.CompilerServices
     {
         public PreserveBaseOverridesAttribute() { }
     }
-    [System.AttributeUsage(System.AttributeTargets.Module, AllowMultiple=false, Inherited=false)]
+    [System.AttributeUsageAttribute(System.AttributeTargets.Module, Inherited=false)]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
     public sealed partial class RefSafetyRulesAttribute : System.Attribute
     {
         public RefSafetyRulesAttribute(int version) { }
         public int Version { get { throw null; } }
     }
     [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
     public sealed class RequiredMemberAttribute : System.Attribute
     {
         public RequiredMemberAttribute() { }
@@ -12947,6 +12977,11 @@ namespace System.Runtime.CompilerServices
         [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
         public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
     }
+    [System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited = false)]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+    public sealed partial class ScopedRefAttribute : Attribute
+    {
+    }
     [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
     public sealed partial class SkipLocalsInitAttribute : System.Attribute
     {
index 67e4657..546742b 100644 (file)
@@ -192,6 +192,32 @@ namespace System.Runtime.CompilerServices.Tests
             Assert.Equal(MethodImplOptions.Unmanaged, attr3.Value);
         }
 
+        [Fact]
+        public static void NullableAttributeTests()
+        {
+            var attr = new NullableAttribute(42);
+            Assert.Equal(new byte[] { 42 }, attr.NullableFlags);
+
+            attr = new NullableAttribute(new byte[] { 1, 2, 3 });
+            Assert.Equal(new byte[] { 1, 2, 3 }, attr.NullableFlags);
+        }
+
+        [Fact]
+        public static void NullableContextAttributeTests()
+        {
+            var attr = new NullableContextAttribute(42);
+            Assert.Equal(42, attr.Flag);
+        }
+
+        [Theory]
+        [InlineData(false)]
+        [InlineData(true)]
+        public static void NullablePublicOnlyAttributeTests(bool includeInternals)
+        {
+            var attr = new NullablePublicOnlyAttribute(includeInternals);
+            Assert.Equal(includeInternals, attr.IncludesInternals);
+        }
+
         [Theory]
         [InlineData(-1)]
         [InlineData(42)]
@@ -300,6 +326,12 @@ namespace System.Runtime.CompilerServices.Tests
         }
 
         [Fact]
+        public static void IsUnmanagedAttributeTests()
+        {
+            new IsUnmanagedAttribute();
+        }
+
+        [Fact]
         public static void EnumeratorCancellationAttributeTests()
         {
             new EnumeratorCancellationAttribute();
@@ -337,6 +369,12 @@ namespace System.Runtime.CompilerServices.Tests
         }
 
         [Fact]
+        public static void ScopedRefAttributeTests()
+        {
+            new ScopedRefAttribute();
+        }
+
+        [Fact]
         public static void CompilerFeatureRequiredTests()
         {
             var attr1 = new CompilerFeatureRequiredAttribute("feature1");
index a17831b..7f47afa 100644 (file)
@@ -170,6 +170,7 @@ namespace System.Text.Json.Serialization.Tests
 
 #if !BUILDING_SOURCE_GENERATOR_TESTS
         [Fact]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp, "NullableContextAttribute is public in corelib in .NET 8+")]
         public async Task TypeWithNullConstructorParameterName_ThrowsNotSupportedException()
         {
             // Regression test for https://github.com/dotnet/runtime/issues/58690