You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/CommunityToolkit.Mvvm.SourceGenerators/Diagnostics/Analyzers/UseObservablePropertyOnSemiAutoPropertyAnalyzer.cs
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -148,7 +148,16 @@ public override void Initialize(AnalysisContext context)
148
148
// We expect a top-level block operation, that immediately returns an expression
149
149
if(context.OperationBlocksis not [IBlockOperation{Operations:[IReturnOperationreturnOperation]}])
150
150
{
151
-
return;
151
+
// Special case for nested blocks (e.g. for code generated by some other tooling)
Copy file name to clipboardExpand all lines: tests/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4120.UnitTests/Test_UseObservablePropertyOnSemiAutoPropertyCodeFixer.cs
+117Lines changed: 117 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,123 @@ public partial class SampleViewModel : ObservableObject
// /0/Test0.cs(7,19): info MVVMTK0056: The semi-auto property MyApp.SampleViewModel.Name can be converted to a partial property using [ObservableProperty], which is recommended (doing so makes the code less verbose and results in more optimized code)
// /0/Test0.cs(7,19): info MVVMTK0056: The semi-auto property MyApp.SampleViewModel.Name can be converted to a partial property using [ObservableProperty], which is recommended (doing so makes the code less verbose and results in more optimized code)
0 commit comments