Closed hughbe closed 4 years ago
@divega @lajones @ajcvickers can you please comment?
While the exception in .NET Core seems "better", we should consider the impact of the breaking change vs. its benefit. I have a gut feel that compat will win in this case.
Agreed. TypeDescriptor
didn't exist at the time this was ported and we did "best efforts". Also we were fine with small incompatibilities back then and that has now changed. Since TypeDescriptor
now exists it seems like the best solution to go back to the old way of doing it (even if that does mean a slightly less useful exception). Will decide in triage tomorrow.
Example test:
On netfx this test passes -
Exception
is thrown. On netcore this test fails -ValidationException
is thrown.This was introduced when porting the library to .NET core, as
TypeDescriptor
did not exist.From the reference source (https://github.com/Microsoft/referencesource/blob/4fe4349175f4c5091d972a7e56ea12012f1e7170/System.ComponentModel.DataAnnotations/DataAnnotations/RangeAttribute.cs#L178-L182):
From the .NET core source (https://github.com/dotnet/corefx/blob/master/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RangeAttribute.cs#L200-L207):
I suggest this is triaged as a .NET core bug. I'm submitting a fix to align it with netfx behaviour.