Open VladimirKhvostov opened 2 years ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Tagging subscribers to this area: @ajcvickers, @bricelam, @roji See info in area-owners.md if you want to be subscribed.
Author: | VladimirKhvostov |
---|---|
Assignees: | - |
Labels: | `area-System.ComponentModel.DataAnnotations`, `untriaged` |
Milestone: | - |
Description
I noticed that regression was introduced in the https://github.com/dotnet/runtime/pull/51772
See example in a Reproduction Steps. An error is reported when this code runs on netcoreapp22, netcoreapp31, and net5.0, but no errors on net6.0.
Notice that Text property is public, but has an internal getter (same behavior when getter is private or protected)
An error is reported when this code runs on netcoreapp22, netcoreapp31, and net5.0, but no errors on net6.0. The regression is in the GetPropertyValues method
Before:
After:
TypeDescriptor.GetProperties method does not return properties which do not have public getter.
I should mention that behavior matches net4.8 behavior and scenario is kind of weird, but it is still a regression, which can cause problems for people upgrading from .NET Core 3.1 or .NET 5.0 to .NET 6.0.
I am glad we had a unit test for this scenario. It took me couple hours to figure out the root of the issue, but if we did not have that unit test, we would have a regression in production.
Reproduction Steps
Expected behavior
Sample program should report an error when running on .NET 6.0 (same as .NET Core 3.1 and .NET 5.0)
Actual behavior
Program does not report any errors.
Regression?
Yes, regression from netcoreapp3.1 and net5.0
Known Workarounds
N/A
Configuration
No response
Other information
No response