diff --git a/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Diagnostics/Analyzers/InvalidPropertyNullableAnnotationAnalyzer.cs b/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Diagnostics/Analyzers/InvalidPropertyNullableAnnotationAnalyzer.cs
index e396f9dd..c93b3988 100644
--- a/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Diagnostics/Analyzers/InvalidPropertyNullableAnnotationAnalyzer.cs
+++ b/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Diagnostics/Analyzers/InvalidPropertyNullableAnnotationAnalyzer.cs
@@ -80,7 +80,8 @@ public override void Initialize(AnalysisContext context)
context.ReportDiagnostic(Diagnostic.Create(
NotNullResilientAccessorsForNullablePropertyDeclaration,
propertySymbol.Locations.FirstOrDefault(),
- propertySymbol));
+ propertySymbol,
+ propertySymbol.Name));
}
}
else
@@ -106,7 +107,8 @@ public override void Initialize(AnalysisContext context)
context.ReportDiagnostic(Diagnostic.Create(
NotNullResilientAccessorsForNotNullablePropertyDeclaration,
propertySymbol.Locations.FirstOrDefault(),
- propertySymbol));
+ propertySymbol,
+ propertySymbol.Name));
}
// In either case, we need to check that either the property is required, or that the default value is not 'null'.
diff --git a/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs b/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs
index b433021b..6d3711de 100644
--- a/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs
+++ b/components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs
@@ -331,28 +331,28 @@ internal static class DiagnosticDescriptors
helpLinkUri: "https://aka.ms/toolkit/labs/windows");
///
- /// The property '{0}' is not annotated as nullable and is using [AllowNull], but neither of its accessors are null-resilient (at least one generated 'On___Get' or 'On___Set' method must be implemented with [NotNull] on the 'propertyValue' parameter, to ensure assigning null values does not break the nullable annotations on the property).
+ /// The property '{0}' is not annotated as nullable and is using [AllowNull], but neither of its accessors are null-resilient (at least one generated 'On{1}Get' or 'On{1}Set' method must be implemented with [NotNull] on the 'propertyValue' parameter, to ensure assigning null values does not break the nullable annotations on the property).
///
public static readonly DiagnosticDescriptor NotNullResilientAccessorsForNotNullablePropertyDeclaration = new(
id: "WCTDP0024",
title: "Non-nullable dependency property using [AllowNull] incorrectly",
- messageFormat: "The property '{0}' is not annotated as nullable and is using [AllowNull], but neither of its accessors are null-resilient (at least one generated 'On___Get' or 'On___Set' method must be implemented with [NotNull] on the 'propertyValue' parameter, to ensure assigning null values does not break the nullable annotations on the property)",
+ messageFormat: "The property '{0}' is not annotated as nullable and is using [AllowNull], but neither of its accessors are null-resilient (at least one generated 'On{1}Get' or 'On{1}Set' method must be implemented with [NotNull] on the 'propertyValue' parameter, to ensure assigning null values does not break the nullable annotations on the property)",
category: DiagnosticCategory,
defaultSeverity: DiagnosticSeverity.Warning,
isEnabledByDefault: true,
- description: "Non-nullable properties annotated with [GeneratedDependencyProperty] using [AllowNull] should have at least one generated 'On___Get' or 'On___Set' method implemented as null-resilient (by adding [NotNull] on the 'propertyValue' parameter) to ensure assigning null values does not break the nullable annotations on the property.",
+ description: "Non-nullable properties annotated with [GeneratedDependencyProperty] using [AllowNull] should have at least one generated getter or setter method (eg. 'OnNameGet', if the property is called 'Name') implemented as null-resilient (by adding [NotNull] on the 'propertyValue' parameter) to ensure assigning null values does not break the nullable annotations on the property.",
helpLinkUri: "https://aka.ms/toolkit/labs/windows");
///
- /// The property '{0}' is annotated as nullable and is using [NotNull], but it's not guaranteeing that returned values will not be null (it must either make its 'get' accessor null-resilient, by implementing at least one generated 'On___Get' method with [NotNull] on the 'propertyValue' parameter, or it must either add [DisallowNull] or implement at least one generated 'On___Set' method with [NotNull], and also either mark the property as required, or ensure that its default value is not null).
+ /// The property '{0}' is annotated as nullable and is using [NotNull], but it's not guaranteeing that returned values will not be null (it must either make its 'get' accessor null-resilient, by implementing at least one generated 'On{1}Get' method with [NotNull] on the 'propertyValue' parameter, or it must either add [DisallowNull] or implement at least one generated 'On{1}Set' method with [NotNull], and also either mark the property as required, or ensure that its default value is not null).
///
public static readonly DiagnosticDescriptor NotNullResilientAccessorsForNullablePropertyDeclaration = new(
id: "WCTDP0025",
title: "Nullable dependency property using [NotNull] incorrectly",
- messageFormat: "The property '{0}' is annotated as nullable and is using [NotNull], but it's not guaranteeing that returned values will not be null (it must either make its 'get' accessor null-resilient, by implementing at least one generated 'On___Get' method with [NotNull] on the 'propertyValue' parameter, or it must either add [DisallowNull] or implement at least one generated 'On___Set' method with [NotNull], and also either mark the property as required, or ensure that its default value is not null)",
+ messageFormat: "The property '{0}' is annotated as nullable and is using [NotNull], but it's not guaranteeing that returned values will not be null (it must either make its 'get' accessor null-resilient, by implementing at least one generated 'On{1}Get' method with [NotNull] on the 'propertyValue' parameter, or it must either add [DisallowNull] or implement at least one generated 'On{1}Set' method with [NotNull], and also either mark the property as required, or ensure that its default value is not null)",
category: DiagnosticCategory,
defaultSeverity: DiagnosticSeverity.Warning,
isEnabledByDefault: true,
- description: "Nullable properties annotated with [GeneratedDependencyProperty] using [NotNull] should make their 'get' accessors null-resilient, by implementing at least one generated 'On___Get' method with [NotNull] on the 'propertyValue' parameter, or they must either add [DisallowNull] or implement at least one generated 'On___Set' method with [NotNull], and also either be marked as required properties, or ensure that the default value is not null.",
+ description: "Nullable properties annotated with [GeneratedDependencyProperty] using [NotNull] should make their 'get' accessors null-resilient, by implementing at least one generated getter method (eg. 'OnNameGet', if the property is called 'Name') with [NotNull] on the 'propertyValue' parameter, or they must either add [DisallowNull] or implement at least one generated setter method (eg. 'OnNameSet', if the property is called 'Name') with [NotNull], and also either be marked as required properties, or ensure that the default value is not null.",
helpLinkUri: "https://aka.ms/toolkit/labs/windows");
}