File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Microsoft.Toolkit.Mvvm/ComponentModel
UnitTests/UnitTests.NetCore/Mvvm Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -489,12 +489,13 @@ static Action<object> GetValidationAction(Type type)
489489 static Action < object > GetValidationActionFallback ( Type type )
490490 {
491491 // Get the collection of all properties to validate
492- PropertyInfo [ ] validatableProperties = (
492+ ( string Name , MethodInfo GetMethod ) [ ] validatableProperties = (
493493 from property in type . GetProperties ( BindingFlags . Instance | BindingFlags . Public )
494494 where property . GetIndexParameters ( ) . Length == 0 &&
495- property . GetCustomAttributes < ValidationAttribute > ( true ) . Any ( ) &&
496- property . GetMethod is not null
497- select property ) . ToArray ( ) ;
495+ property . GetCustomAttributes < ValidationAttribute > ( true ) . Any ( )
496+ let getMethod = property . GetMethod
497+ where getMethod is not null
498+ select ( property . Name , getMethod ) ) . ToArray ( ) ;
498499
499500 // Short path if there are no properties to validate
500501 if ( validatableProperties . Length == 0 )
Original file line number Diff line number Diff line change 1212using Microsoft . Toolkit . Mvvm . ComponentModel ;
1313using Microsoft . VisualStudio . TestTools . UnitTesting ;
1414
15- #pragma warning disable SA1124
15+ #pragma warning disable SA1124 , SA1307 , SA1401
1616
1717#nullable enable
1818
@@ -371,7 +371,7 @@ public partial class ModelWithValuePropertyWithValidation : ObservableValidator
371371 [ MinLength ( 5 ) ]
372372 private string ? value ;
373373 }
374-
374+
375375 public partial class ViewModelWithValidatableGeneratedProperties : ObservableValidator
376376 {
377377 [ Required ]
You can’t perform that action at this time.
0 commit comments