1616using  Microsoft . CodeAnalysis ; 
1717using  Microsoft . CodeAnalysis . CSharp ; 
1818using  Microsoft . CodeAnalysis . CSharp . Syntax ; 
19+ using  Microsoft . CodeAnalysis . Diagnostics ; 
1920using  static  CommunityToolkit . Mvvm . SourceGenerators . Diagnostics . DiagnosticDescriptors ; 
2021using  static  Microsoft . CodeAnalysis . CSharp . SyntaxFactory ; 
2122
@@ -35,6 +36,7 @@ internal static class Execute
3536        /// <param name="fieldSyntax">The <see cref="FieldDeclarationSyntax"/> instance to process.</param> 
3637        /// <param name="fieldSymbol">The input <see cref="IFieldSymbol"/> instance to process.</param> 
3738        /// <param name="semanticModel">The <see cref="SemanticModel"/> instance for the current run.</param> 
39+         /// <param name="options">The options in use for the generator.</param> 
3840        /// <param name="token">The cancellation token for the current operation.</param> 
3941        /// <param name="propertyInfo">The resulting <see cref="PropertyInfo"/> value, if successfully retrieved.</param> 
4042        /// <param name="diagnostics">The resulting diagnostics from the processing operation.</param> 
@@ -43,6 +45,7 @@ public static bool TryGetInfo(
4345            FieldDeclarationSyntax  fieldSyntax , 
4446            IFieldSymbol  fieldSymbol , 
4547            SemanticModel  semanticModel , 
48+             AnalyzerConfigOptions  options , 
4649            CancellationToken  token , 
4750            [ NotNullWhen ( true ) ]  out  PropertyInfo ?  propertyInfo , 
4851            out  ImmutableArray < DiagnosticInfo >  diagnostics ) 
@@ -66,6 +69,11 @@ public static bool TryGetInfo(
6669
6770            token . ThrowIfCancellationRequested ( ) ; 
6871
72+             // Override the property changing support if explicitly disabled 
73+             shouldInvokeOnPropertyChanging  &=  GetEnableINotifyPropertyChangingSupport ( options ) ; 
74+ 
75+             token . ThrowIfCancellationRequested ( ) ; 
76+ 
6977            // Get the property type and name 
7078            string  typeNameWithNullabilityAnnotations  =  fieldSymbol . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ; 
7179            string  fieldName  =  fieldSymbol . Name ; 
@@ -320,6 +328,27 @@ public static bool TryGetInfo(
320328            return  true ; 
321329        } 
322330
331+         /// <summary> 
332+         /// Gets the value for the "MvvmToolkitEnableINotifyPropertyChangingSupport" property. 
333+         /// </summary> 
334+         /// <param name="options">The options in use for the generator.</param> 
335+         /// <returns>The value for the "MvvmToolkitEnableINotifyPropertyChangingSupport" property.</returns> 
336+         public  static   bool  GetEnableINotifyPropertyChangingSupport ( AnalyzerConfigOptions  options ) 
337+         { 
338+             if  ( options . TryGetValue ( "build_property.MvvmToolkitEnableINotifyPropertyChangingSupport" ,  out  string ?  propertyValue ) ) 
339+             { 
340+                 if  ( bool . TryParse ( propertyValue ,  out  bool  enableINotifyPropertyChangingSupport ) ) 
341+                 { 
342+                     return  enableINotifyPropertyChangingSupport ; 
343+                 } 
344+             } 
345+ 
346+             // This setting is enabled by default, for backwards compatibility. 
347+             // Note that this path should never be reached, as the default 
348+             // value is also set in a .targets file bundled in the package. 
349+             return  true ; 
350+         } 
351+ 
323352        /// <summary> 
324353        /// Validates the containing type for a given field being annotated. 
325354        /// </summary> 
0 commit comments