diff --git a/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/EmbeddedResources/GeneratedDependencyPropertyAttribute.cs b/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/EmbeddedResources/GeneratedDependencyPropertyAttribute.cs index c94eb6652..bcffcfa02 100644 --- a/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/EmbeddedResources/GeneratedDependencyPropertyAttribute.cs +++ b/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/EmbeddedResources/GeneratedDependencyPropertyAttribute.cs @@ -71,6 +71,9 @@ internal sealed class GeneratedDependencyPropertyAttribute : global::System.Attr /// /// Using this property is mutually exclusive with . /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.DisallowNull] +#endif public string? DefaultValueCallback { get; init; } = null; /// diff --git a/components/DependencyPropertyGenerator/src/GeneratedDependencyPropertyAttribute.cs b/components/DependencyPropertyGenerator/src/GeneratedDependencyPropertyAttribute.cs index 1510b9f33..ffc3dca67 100644 --- a/components/DependencyPropertyGenerator/src/GeneratedDependencyPropertyAttribute.cs +++ b/components/DependencyPropertyGenerator/src/GeneratedDependencyPropertyAttribute.cs @@ -3,6 +3,9 @@ // See the LICENSE file in the project root for more information. using System; +#if NET8_0_OR_GREATER +using System.Diagnostics.CodeAnalysis; +#endif #if WINDOWS_UWP || HAS_UNO using DependencyObject = Windows.UI.Xaml.DependencyObject; using DependencyProperty = Windows.UI.Xaml.DependencyProperty; @@ -62,6 +65,9 @@ public sealed class GeneratedDependencyPropertyAttribute : Attribute /// /// Using this property is mutually exclusive with . /// +#if NET8_0_OR_GREATER + [DisallowNull] +#endif public string? DefaultValueCallback { get; init; } = null; ///