Skip to content

Commit 9789f34

Browse files
committed
Use 'GetMSBuildBooleanPropertyValue' in more places
1 parent abf1b6b commit 9789f34

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

src/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservablePropertyGenerator.Execute.cs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ public static bool TryGetInfo(
153153

154154
token.ThrowIfCancellationRequested();
155155

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

159160
token.ThrowIfCancellationRequested();
160161

@@ -378,27 +379,6 @@ public static bool TryGetInfo(
378379
return true;
379380
}
380381

381-
/// <summary>
382-
/// Gets the value for the "MvvmToolkitEnableINotifyPropertyChangingSupport" property.
383-
/// </summary>
384-
/// <param name="options">The options in use for the generator.</param>
385-
/// <returns>The value for the "MvvmToolkitEnableINotifyPropertyChangingSupport" property.</returns>
386-
public static bool GetEnableINotifyPropertyChangingSupport(AnalyzerConfigOptions options)
387-
{
388-
if (options.TryGetValue("build_property.MvvmToolkitEnableINotifyPropertyChangingSupport", out string? propertyValue))
389-
{
390-
if (bool.TryParse(propertyValue, out bool enableINotifyPropertyChangingSupport))
391-
{
392-
return enableINotifyPropertyChangingSupport;
393-
}
394-
}
395-
396-
// This setting is enabled by default, for backwards compatibility.
397-
// Note that this path should never be reached, as the default
398-
// value is also set in a .targets file bundled in the package.
399-
return true;
400-
}
401-
402382
/// <summary>
403383
/// Validates the containing type for a given field being annotated.
404384
/// </summary>

0 commit comments

Comments
 (0)