Open dhebbler opened 4 years ago
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Thanks for contacting us. We will try to address this in the future. For now, try to remove the new
keyword if you can when declaring the OrderId
property - maybe by renaming to something else?
@mkArtakMSFT - running into this issue. I have a DTO/Model that comes for another library. we inherit it and override the members with new
and get/set reference back to the base
such that we can add our own validation rules onto it - in this case [RegularExpression]
.
[RegularExpression(@"^[1-9]\d*$", ErrorMessage = "Minimum 1")]
public new int MyMember { get => base.MyMember; set => base.MyMember = value ; }
The difference in out case is that were overload the type type t be short so its more like this:
[RegularExpression(@"^[1-9]\d*$", ErrorMessage = "Minimum 1")]
public new int MyMember { get => base.MyMember; set => base.MyMember = (short)value ; }
This is done for all the member but breaks only where we overload the type member - if that inform the solution as a variable of the ambiguity to the original poster, but do get the error in the original posters scenario.
Any chance this gets addressed in an upcoming release given the current tagging? Any other work arounds...
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Describe the bug
We have a Blazor server side application that throws AmbiguousMatchException when editing values.
The DataAnnotationsValidator throws an AmbiguousMatchException when it encounters an object that has hidden members. This exception is thrown when you edit the input and the validator responds to the NotifyFieldChanged. The validator uses reflection to determine validation attributes. When the object being validated includes a hidden member, the GetProperty call without including specific binding flags sees both properties.
To Reproduce
This is a simple razor page. The model shown here is the minimum required to reproduce the issue. In our implementation this same OO pattern is inside a library that we do not have the ability to modify.
The exception will occur if you change the value of the InputNumber and tab away.
Exceptions (if any)
Further technical details
ASP.NET Core version AspNetCore 5.0.0-preview.2.20167.3
Include the output of
dotnet --info
Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.100-rc.2.20479.15\
Host (useful for support): Version: 5.0.0-rc.2.20475.5 Commit: c5a3f49c88
.NET SDKs installed: 5.0.100-rc.2.20479.15 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.0-rc.2.20475.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]