Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Currently System.ComponentModel.DataAnnotations.ValidationContext always sets its DisplayName property to the type name. This is inconsistent with the .NET implementation. This is the line where the issue comes from
On .NET the DisplayName is set based on the DisplayAttribute of the member being validated. If one isn't used then it falls back to the member name. And if that's not available, such as when calling a class level validator, it then uses the type name.
I ran into this while building out the DataAnnotations support in NancyFX. My workaround can be seen here https://github.com/xt0rted/Nancy/blob/b540b5b07326964d52b82660d59ae50ad0fdd77b/src/Nancy.Validation.DataAnnotations/DataAnnotationsValidatorAdapter.cs#L66-73
It should be noted that in order to better understand how this was working and what needed to be fixed I did look at the source code for the ValidationContent class on http://referencesource.microsoft.com, though my implementation is not the same as theirs.
Resolved in master