diff --git a/src/libraries/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.cs b/src/libraries/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.cs index 8658dcecfd6b7..9dc07077afd00 100644 --- a/src/libraries/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.cs +++ b/src/libraries/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.cs @@ -6,8 +6,8 @@ namespace System.ComponentModel.DataAnnotations { - [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple = false)] - [System.CLSCompliant(false)] + [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false)] + [System.CLSCompliantAttribute(false)] public partial class AllowedValuesAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute { public AllowedValuesAttribute(params object?[] values) { } @@ -32,8 +32,8 @@ public AssociationAttribute(string name, string thisKey, string otherKey) { } public string ThisKey { get { throw null; } } public System.Collections.Generic.IEnumerable ThisKeyMembers { get { throw null; } } } - [System.AttributeUsageAttribute(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)] - public class Base64StringAttribute : ValidationAttribute + [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false)] + public partial class Base64StringAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute { public Base64StringAttribute() { } public override bool IsValid(object? value) { throw null; } @@ -101,8 +101,8 @@ public DataTypeAttribute(string customDataType) { } public virtual string GetDataTypeName() { throw null; } public override bool IsValid(object? value) { throw null; } } - [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple = false)] - [System.CLSCompliant(false)] + [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false)] + [System.CLSCompliantAttribute(false)] public partial class DeniedValuesAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute { public DeniedValuesAttribute(params object?[] values) { } @@ -205,13 +205,13 @@ public sealed partial class KeyAttribute : System.Attribute { public KeyAttribute() { } } - [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple = false)] + [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false)] public partial class LengthAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Uses reflection to get the 'Count' property on types that don't implement ICollection. This 'Count' property may be trimmed. Ensure it is preserved.")] public LengthAttribute(int minimumLength, int maximumLength) { } - public int MinimumLength { get { throw null; } } public int MaximumLength { get { throw null; } } + public int MinimumLength { get { throw null; } } public override string FormatErrorMessage(string name) { throw null; } public override bool IsValid(object? value) { throw null; } } @@ -270,8 +270,8 @@ public RangeAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMember public partial class RegularExpressionAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute { public RegularExpressionAttribute([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Regex")] string pattern) { } - public int MatchTimeoutInMilliseconds { get { throw null; } set { } } public System.TimeSpan MatchTimeout { get { throw null; } } + public int MatchTimeoutInMilliseconds { get { throw null; } set { } } public string Pattern { get { throw null; } } public override string FormatErrorMessage(string name) { throw null; } public override bool IsValid(object? value) { throw null; } @@ -342,11 +342,11 @@ public void Validate(object? value, string name) { } } public sealed partial class ValidationContext : System.IServiceProvider { - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered.")] + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")] public ValidationContext(object instance) { } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered.")] + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")] public ValidationContext(object instance, System.Collections.Generic.IDictionary? items) { } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered.")] + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")] public ValidationContext(object instance, System.IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary? items) { } public string DisplayName { get { throw null; } set { } } public System.Collections.Generic.IDictionary Items { get { throw null; } } @@ -380,16 +380,16 @@ public ValidationResult(string? errorMessage, System.Collections.Generic.IEnumer } public static partial class Validator { - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered.")] + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")] public static bool TryValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection? validationResults) { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered.")] + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")] public static bool TryValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection? validationResults, bool validateAllProperties) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of validationContext.ObjectType cannot be statically discovered.")] public static bool TryValidateProperty(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection? validationResults) { throw null; } public static bool TryValidateValue(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection? validationResults, System.Collections.Generic.IEnumerable validationAttributes) { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered.")] + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")] public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered.")] + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")] public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, bool validateAllProperties) { } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Type of validationContext.ObjectType cannot be statically discovered.")] public static void ValidateProperty(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { } diff --git a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationContext.cs b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationContext.cs index c08d3ae029489..9aafe4f2f5a6f 100644 --- a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationContext.cs +++ b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationContext.cs @@ -27,7 +27,7 @@ public sealed class ValidationContext // Also we use this ability in Validator.CreateValidationContext()?? : IServiceProvider { - internal const string InstanceTypeNotStaticallyDiscovered = "The Type of instance cannot be statically discovered."; + internal const string InstanceTypeNotStaticallyDiscovered = "The Type of instance cannot be statically discovered and the Type's properties can be trimmed."; #region Member Fields diff --git a/src/libraries/apicompat/ApiCompatBaselineExcludedAttributes.txt b/src/libraries/apicompat/ApiCompatBaselineExcludedAttributes.txt index 7cb41fe1bb531..e7d6351c15d90 100644 --- a/src/libraries/apicompat/ApiCompatBaselineExcludedAttributes.txt +++ b/src/libraries/apicompat/ApiCompatBaselineExcludedAttributes.txt @@ -1,5 +1,6 @@ // These attributes shouldn't be checked against baseline reference assemblies T:System.CLSCompliantAttribute +T:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute T:System.ComponentModel.EditorBrowsableAttribute T:System.ObsoleteAttribute