@@ -571,6 +571,7 @@ public void Test_RelayCommandAttribute_CanExecuteWithNullabilityAnnotations()
571571 [ TestMethod ]
572572 public void Test_RelayCommandAttribute_WithExplicitAttributesForFieldAndProperty ( )
573573 {
574+ #if ! ROSLYN_4_12_0_OR_GREATER
574575 FieldInfo fooField = typeof ( MyViewModelWithExplicitFieldAndPropertyAttributes ) . GetField ( "fooCommand" , BindingFlags . Instance | BindingFlags . NonPublic ) ! ;
575576
576577 Assert . IsNotNull ( fooField . GetCustomAttribute < RequiredAttribute > ( ) ) ;
@@ -579,6 +580,7 @@ public void Test_RelayCommandAttribute_WithExplicitAttributesForFieldAndProperty
579580 Assert . IsNotNull ( fooField . GetCustomAttribute < MaxLengthAttribute > ( ) ) ;
580581 Assert . AreEqual ( 100 , fooField . GetCustomAttribute < MaxLengthAttribute > ( ) ! . Length ) ;
581582
583+ #endif
582584 PropertyInfo fooProperty = typeof ( MyViewModelWithExplicitFieldAndPropertyAttributes ) . GetProperty ( "FooCommand" ) ! ;
583585
584586 Assert . IsNotNull ( fooProperty . GetCustomAttribute < RequiredAttribute > ( ) ) ;
@@ -618,17 +620,21 @@ static void ValidateTestAttribute(TestValidationAttribute testAttribute)
618620 Assert . AreEqual ( Test_ObservablePropertyAttribute . Animal . Llama , testAttribute . Animal ) ;
619621 }
620622
623+ #if ! ROSLYN_4_12_0_OR_GREATER
621624 FieldInfo fooBarField = typeof ( MyViewModelWithExplicitFieldAndPropertyAttributes ) . GetField ( "fooBarCommand" , BindingFlags . Instance | BindingFlags . NonPublic ) ! ;
622625
623626 ValidateTestAttribute ( fooBarField . GetCustomAttribute < TestValidationAttribute > ( ) ! ) ;
627+ #endif
624628
625629 PropertyInfo fooBarProperty = typeof ( MyViewModelWithExplicitFieldAndPropertyAttributes ) . GetProperty ( "FooBarCommand" ) ! ;
626630
627631 ValidateTestAttribute ( fooBarProperty . GetCustomAttribute < TestValidationAttribute > ( ) ! ) ;
628632
633+ #if ! ROSLYN_4_12_0_OR_GREATER
629634 FieldInfo barBazField = typeof ( MyViewModelWithExplicitFieldAndPropertyAttributes ) . GetField ( "barBazCommand" , BindingFlags . Instance | BindingFlags . NonPublic ) ! ;
630635
631636 Assert . IsNotNull ( barBazField . GetCustomAttribute < Test_ObservablePropertyAttribute . TestAttribute > ( ) ) ;
637+ #endif
632638
633639 PropertyInfo barBazCommand = typeof ( MyViewModelWithExplicitFieldAndPropertyAttributes ) . GetProperty ( "BarBazCommand" ) ! ;
634640
@@ -670,23 +676,27 @@ public void Test_RelayCommandAttribute_WithPartialCommandMethodDefinitions()
670676 _ = Assert . IsInstanceOfType < RelayCommand > ( model . BazCommand ) ;
671677 _ = Assert . IsInstanceOfType < AsyncRelayCommand > ( model . FooBarCommand ) ;
672678
679+ #if ! ROSLYN_4_12_0_OR_GREATER
673680 FieldInfo bazField = typeof ( ModelWithPartialCommandMethods ) . GetField ( "bazCommand" , BindingFlags . Instance | BindingFlags . NonPublic ) ! ;
674681
675682 Assert . IsNotNull ( bazField . GetCustomAttribute < RequiredAttribute > ( ) ) ;
676683 Assert . IsNotNull ( bazField . GetCustomAttribute < MinLengthAttribute > ( ) ) ;
677684 Assert . AreEqual ( 1 , bazField . GetCustomAttribute < MinLengthAttribute > ( ) ! . Length ) ;
685+ #endif
678686
679687 PropertyInfo bazProperty = typeof ( ModelWithPartialCommandMethods ) . GetProperty ( "BazCommand" ) ! ;
680688
681689 Assert . IsNotNull ( bazProperty . GetCustomAttribute < MinLengthAttribute > ( ) ) ;
682690 Assert . AreEqual ( 2 , bazProperty . GetCustomAttribute < MinLengthAttribute > ( ) ! . Length ) ;
683691 Assert . IsNotNull ( bazProperty . GetCustomAttribute < XmlIgnoreAttribute > ( ) ) ;
684692
693+ #if ! ROSLYN_4_12_0_OR_GREATER
685694 FieldInfo fooBarField = typeof ( ModelWithPartialCommandMethods ) . GetField ( "fooBarCommand" , BindingFlags . Instance | BindingFlags . NonPublic ) ! ;
686695
687696 Assert . IsNotNull ( fooBarField . GetCustomAttribute < RequiredAttribute > ( ) ) ;
688697 Assert . IsNotNull ( fooBarField . GetCustomAttribute < MinLengthAttribute > ( ) ) ;
689- Assert . AreEqual ( 1 , fooBarField . GetCustomAttribute < MinLengthAttribute > ( ) ! . Length ) ;
698+ Assert . AreEqual ( 1 , fooBarField . GetCustomAttribute < MinLengthAttribute > ( ) ! . Length ) ;
699+ #endif
690700
691701 PropertyInfo fooBarProperty = typeof ( ModelWithPartialCommandMethods ) . GetProperty ( "FooBarCommand" ) ! ;
692702
0 commit comments