diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/ExperimentalAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/ExperimentalAttribute.cs
index 198341e3f78a6..65429998ab591 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/ExperimentalAttribute.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/ExperimentalAttribute.cs
@@ -49,6 +49,15 @@ public ExperimentalAttribute(string diagnosticId)
///
public string DiagnosticId { get; }
+ ///
+ /// Gets or sets an optional message associated with the experimental attribute.
+ ///
+ /// The message that provides additional information about the experimental feature.
+ ///
+ /// This message can be used to provide more context or guidance about the experimental feature.
+ ///
+ public string? Message { get; set; }
+
///
/// Gets or sets the URL for corresponding documentation.
/// The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID.
diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs
index 1d354dd846c30..b7fe868aff86d 100644
--- a/src/libraries/System.Runtime/ref/System.Runtime.cs
+++ b/src/libraries/System.Runtime/ref/System.Runtime.cs
@@ -8869,6 +8869,7 @@ public sealed partial class ExperimentalAttribute : System.Attribute
{
public ExperimentalAttribute(string diagnosticId) { }
public string DiagnosticId { get { throw null; } }
+ public string? Message { get { throw null; } set { } }
public string? UrlFormat { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ExperimentalAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ExperimentalAttributeTests.cs
index 91beaf2991fca..4088037a54ac3 100644
--- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ExperimentalAttributeTests.cs
+++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ExperimentalAttributeTests.cs
@@ -36,5 +36,20 @@ public void TestSetUrlFormat(string urlFormat)
Assert.Equal("diagnosticId", attr.DiagnosticId);
Assert.Equal(urlFormat, attr.UrlFormat);
}
+
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("This is an experimental feature")]
+ public void TestSetMessage(string message)
+ {
+ var attribute = new ExperimentalAttribute("diagnosticId")
+ {
+ Message = message
+ };
+
+ Assert.Equal("diagnosticId", attribute.DiagnosticId);
+ Assert.Equal(message, attribute.Message);
+ }
}
}