@@ -1531,6 +1531,77 @@ public partial class {|MVVMTK0033:SampleViewModel|}
15311531        await  VerifyAnalyzerDiagnosticsAndSuccessfulGeneration < ClassUsingAttributeInsteadOfInheritanceAnalyzer > ( source ,  LanguageVersion . CSharp8 ) ; 
15321532    } 
15331533
1534+     // See https://github.com/CommunityToolkit/dotnet/issues/518 
1535+     [ TestMethod ] 
1536+     public  async  Task  FieldReferenceToFieldWithObservablePropertyAttribute_Assignment ( ) 
1537+     { 
1538+         string  source  =  """ 
1539+             using CommunityToolkit.Mvvm.ComponentModel; 
1540+ 
1541+             partial class MyViewModel : ObservableObject 
1542+             { 
1543+                 [ObservableProperty] 
1544+                 int number; 
1545+ 
1546+                 void M1() 
1547+                 { 
1548+                     {|MVVMTK0034:number|} = 1; 
1549+                 } 
1550+ 
1551+                 void M2() 
1552+                 { 
1553+                     {|MVVMTK0034:this.number|} = 1; 
1554+                 } 
1555+             } 
1556+             """ ; 
1557+ 
1558+         await  VerifyAnalyzerDiagnosticsAndSuccessfulGeneration < FieldReferenceForObservablePropertyFieldAnalyzer > ( source ,  LanguageVersion . CSharp8 ) ; 
1559+     } 
1560+ 
1561+     // See https://github.com/CommunityToolkit/dotnet/issues/518 
1562+     [ TestMethod ] 
1563+     public  async  Task  FieldReferenceToFieldWithObservablePropertyAttribute_Read ( ) 
1564+     { 
1565+         string  source  =  """ 
1566+             using CommunityToolkit.Mvvm.ComponentModel; 
1567+ 
1568+             partial class MyViewModel : ObservableObject 
1569+             { 
1570+                 [ObservableProperty] 
1571+                 int number; 
1572+ 
1573+                 void M() 
1574+                 { 
1575+                     var temp = {|MVVMTK0034:number|}; 
1576+                 } 
1577+             } 
1578+             """ ; 
1579+ 
1580+         await  VerifyAnalyzerDiagnosticsAndSuccessfulGeneration < FieldReferenceForObservablePropertyFieldAnalyzer > ( source ,  LanguageVersion . CSharp8 ) ; 
1581+     } 
1582+ 
1583+     // See https://github.com/CommunityToolkit/dotnet/issues/518 
1584+     [ TestMethod ] 
1585+     public  async  Task  FieldReferenceToFieldWithObservablePropertyAttribute_Ref ( ) 
1586+     { 
1587+         string  source  =  """ 
1588+             using CommunityToolkit.Mvvm.ComponentModel; 
1589+ 
1590+             partial class MyViewModel : ObservableObject 
1591+             { 
1592+                 [ObservableProperty] 
1593+                 int number; 
1594+ 
1595+                 void M() 
1596+                 { 
1597+                     ref var x = ref {|MVVMTK0034:number|}; 
1598+                 } 
1599+             } 
1600+             """ ; 
1601+ 
1602+         await  VerifyAnalyzerDiagnosticsAndSuccessfulGeneration < FieldReferenceForObservablePropertyFieldAnalyzer > ( source ,  LanguageVersion . CSharp8 ) ; 
1603+     } 
1604+ 
15341605    /// <summary> 
15351606    /// Verifies the diagnostic errors for a given analyzer, and that all available source generators can run successfully with the input source (including subsequent compilation). 
15361607    /// </summary> 
0 commit comments