diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index dd1b72541..2a723d2c6 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 6.1.1-beta12 + 6.1.1 diff --git a/test/UnitTest/Components/ValidateTest.cs b/test/UnitTest/Components/ValidateTest.cs index c51754ade..f84a6d174 100644 --- a/test/UnitTest/Components/ValidateTest.cs +++ b/test/UnitTest/Components/ValidateTest.cs @@ -499,6 +499,28 @@ namespace UnitTest.Components }); } + [Fact] + public void Required_AmbiguousMatch() + { + var model = new Cat(); + var rules = new List + { + new FormItemValidator(new RequiredAttribute()) + }; + var cut = Context.RenderComponent(builder => + { + builder.Add(v => v.Model, model); + builder.AddChildContent>(pb => + { + pb.Add(v => v.Value, model.Foo); + pb.Add(v => v.ValueExpression, Utility.GenerateValueExpression(model, nameof(Cat.Foo), typeof(int))); + pb.Add(v => v.ValidateRules, rules); + }); + }); + + // 不会报错 AmbiguousMatchException + } + [Fact] public void TooltipHost_Ok() { @@ -532,5 +554,16 @@ namespace UnitTest.Components OnValidate(true); } } + + class Dummy + { + public virtual string? Foo { get; set; } + } + + class Cat : Dummy + { + [Required] + public new int Foo { get; set; } + } } }