Skip to content
Prev Previous commit
Next Next commit
Use 'GetMSBuildBooleanPropertyValue' in more places
  • Loading branch information
Sergio0694 committed Nov 7, 2024
commit 374b2d0fefb77b503db3633b21700c1c074e87f6
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ public static bool TryGetInfo(

token.ThrowIfCancellationRequested();

// Override the property changing support if explicitly disabled
shouldInvokeOnPropertyChanging &= GetEnableINotifyPropertyChangingSupport(options);
// Override the property changing support if explicitly disabled.
// This setting is enabled by default, for backwards compatibility.
shouldInvokeOnPropertyChanging &= options.GetMSBuildBooleanPropertyValue("MvvmToolkitEnableINotifyPropertyChangingSupport", defaultValue: true);

token.ThrowIfCancellationRequested();

Expand Down Expand Up @@ -378,27 +379,6 @@ public static bool TryGetInfo(
return true;
}

/// <summary>
/// Gets the value for the "MvvmToolkitEnableINotifyPropertyChangingSupport" property.
/// </summary>
/// <param name="options">The options in use for the generator.</param>
/// <returns>The value for the "MvvmToolkitEnableINotifyPropertyChangingSupport" property.</returns>
public static bool GetEnableINotifyPropertyChangingSupport(AnalyzerConfigOptions options)
{
if (options.TryGetValue("build_property.MvvmToolkitEnableINotifyPropertyChangingSupport", out string? propertyValue))
{
if (bool.TryParse(propertyValue, out bool enableINotifyPropertyChangingSupport))
{
return enableINotifyPropertyChangingSupport;
}
}

// This setting is enabled by default, for backwards compatibility.
// Note that this path should never be reached, as the default
// value is also set in a .targets file bundled in the package.
return true;
}

/// <summary>
/// Validates the containing type for a given field being annotated.
/// </summary>
Expand Down