dotnet / dotnet/dotnet-api-docs

RegularExpressionAttribute.IsValid has incorrect Exceptions section

Open
#8,164 2 comments 0 reactions 0 assignees View on GitHub
area-System.ComponentModel.DataAnnotations Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

* `RegularExpressionValidator.IsValid` [does not throw](https://github.com/dotnet/runtime/blob/20120e0d1c5f091e3596cb6dcb163ac2501220b7/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RegularExpressionAttribute.cs#L56) `ValidationException`
* The documentation says it throws `ArgumentException` for the regex pattern even though that's not an actual argument to the public method.
* Also, the documentation doesn't explain how an argument typed as `Object?` (which is not a `String`) can be validated by a regular expression - or what happens to `null` arguments.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.