Skip to content

Commit b0e178e

Browse files
committed
Add '[DisallowNull]' to 'DefaultValueCallback'
1 parent c053699 commit b0e178e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/EmbeddedResources/GeneratedDependencyPropertyAttribute.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ internal sealed class GeneratedDependencyPropertyAttribute : global::System.Attr
7171
/// <remarks>
7272
/// Using this property is mutually exclusive with <see cref="DefaultValue"/>.
7373
/// </remarks>
74+
#if NET8_0_OR_GREATER
75+
[global::System.Diagnostics.CodeAnalysis.DisallowNull]
76+
#endif
7477
public string? DefaultValueCallback { get; init; } = null;
7578

7679
/// <summary>

components/DependencyPropertyGenerator/src/GeneratedDependencyPropertyAttribute.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
#if NET8_0_OR_GREATER
7+
using System.Diagnostics.CodeAnalysis;
8+
#endif
69
#if WINDOWS_UWP || HAS_UNO
710
using DependencyObject = Windows.UI.Xaml.DependencyObject;
811
using DependencyProperty = Windows.UI.Xaml.DependencyProperty;
@@ -62,6 +65,9 @@ public sealed class GeneratedDependencyPropertyAttribute : Attribute
6265
/// <remarks>
6366
/// Using this property is mutually exclusive with <see cref="DefaultValue"/>.
6467
/// </remarks>
68+
#if NET8_0_OR_GREATER
69+
[DisallowNull]
70+
#endif
6571
public string? DefaultValueCallback { get; init; } = null;
6672

6773
/// <summary>

0 commit comments

Comments
 (0)