Skip to content

Commit

Permalink
[release/8.0] Fix nullable annotation for Validator.TryValidateValue …
Browse files Browse the repository at this point in the history
…and ValidateValue (#91293)

* Fix nullable annotation for Validator.TryValidateValue and ValidateValue

* Revert Options source generator nullable annotation changes for Validator.TryValidateValue (#91305)

* Fix nullable annotation for Validator.ValidateValue ref source (#91351)

---------

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and jeffhandley committed Aug 31, 2023
1 parent 35f043f commit 9c422ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,14 @@ public static partial class Validator
public static bool TryValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult>? 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<System.ComponentModel.DataAnnotations.ValidationResult>? validationResults) { throw null; }
public static bool TryValidateValue(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult>? validationResults, System.Collections.Generic.IEnumerable<System.ComponentModel.DataAnnotations.ValidationAttribute> validationAttributes) { throw null; }
public static bool TryValidateValue(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult>? validationResults, System.Collections.Generic.IEnumerable<System.ComponentModel.DataAnnotations.ValidationAttribute> validationAttributes) { throw null; }
[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 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) { }
public static void ValidateValue(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.IEnumerable<System.ComponentModel.DataAnnotations.ValidationAttribute> validationAttributes) { }
public static void ValidateValue(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.IEnumerable<System.ComponentModel.DataAnnotations.ValidationAttribute> validationAttributes) { }
}
}
namespace System.ComponentModel.DataAnnotations.Schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static bool TryValidateObject(object instance, ValidationContext validati
/// then all validators will be evaluated.
/// </para>
/// </remarks>
/// <param name="value">The value to test. It cannot be null.</param>
/// <param name="value">The value to test.</param>
/// <param name="validationContext">
/// Describes the object being validated and provides services and context for the
/// validators.
Expand All @@ -182,7 +182,7 @@ public static bool TryValidateObject(object instance, ValidationContext validati
/// <paramref name="value" /> against.
/// </param>
/// <returns><c>true</c> if the object is valid, <c>false</c> if any validation errors are encountered.</returns>
public static bool TryValidateValue(object value, ValidationContext validationContext,
public static bool TryValidateValue(object? value, ValidationContext validationContext,
ICollection<ValidationResult>? validationResults, IEnumerable<ValidationAttribute> validationAttributes)
{
ArgumentNullException.ThrowIfNull(validationAttributes);
Expand Down Expand Up @@ -303,12 +303,12 @@ public static void ValidateObject(object instance, ValidationContext validationC
/// first.
/// </para>
/// </remarks>
/// <param name="value">The value to test. It cannot be null.</param>
/// <param name="value">The value to test.</param>
/// <param name="validationContext">Describes the object being tested.</param>
/// <param name="validationAttributes">The list of <see cref="ValidationAttribute" />s to validate against this instance.</param>
/// <exception cref="ArgumentNullException">When <paramref name="validationContext" /> is null.</exception>
/// <exception cref="ValidationException">When <paramref name="value" /> is found to be invalid.</exception>
public static void ValidateValue(object value, ValidationContext validationContext,
public static void ValidateValue(object? value, ValidationContext validationContext,
IEnumerable<ValidationAttribute> validationAttributes)
{
ArgumentNullException.ThrowIfNull(validationContext);
Expand Down

0 comments on commit 9c422ed

Please sign in to comment.