You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// <param name="NotifiedCommandNames">The sequence of commands to notify.</param>
24
25
/// <param name="NotifyPropertyChangedRecipients">Whether or not the generated property also broadcasts changes.</param>
25
26
/// <param name="NotifyDataErrorInfo">Whether or not the generated property also validates its value.</param>
26
-
/// <param name="IsRequired">Whether or not the generated property should be marked as required.</param>
27
27
/// <param name="IsOldPropertyValueDirectlyReferenced">Whether the old property value is being directly referenced.</param>
28
28
/// <param name="IsReferenceTypeOrUnconstrainedTypeParameter">Indicates whether the property is of a reference type or an unconstrained type parameter.</param>
29
29
/// <param name="IncludeMemberNotNullOnSetAccessor">Indicates whether to include nullability annotations on the setter.</param>
@@ -34,6 +34,7 @@ internal sealed record PropertyInfo(
34
34
stringTypeNameWithNullabilityAnnotations,
35
35
stringFieldName,
36
36
stringPropertyName,
37
+
EquatableArray<ushort>PropertyModifers,
37
38
AccessibilityPropertyAccessibility,
38
39
AccessibilityGetterAccessibility,
39
40
AccessibilitySetterAccessibility,
@@ -42,7 +43,6 @@ internal sealed record PropertyInfo(
if(context.Compilation.GetTypeByMetadataName("CommunityToolkit.Mvvm.ComponentModel.ObservablePropertyAttribute")is not INamedTypeSymbolobservablePropertySymbol)
32
+
{
33
+
return;
34
+
}
35
+
36
+
context.RegisterSymbolAction(context =>
37
+
{
38
+
// Ensure that we have a valid target symbol to analyze
39
+
if(context.Symbolis not (IFieldSymbol or IPropertySymbol))
40
+
{
41
+
return;
42
+
}
43
+
44
+
// If the property is not using [ObservableProperty], there's nothing to do
Copy file name to clipboardExpand all lines: src/CommunityToolkit.Mvvm.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -907,4 +907,20 @@ internal static class DiagnosticDescriptors
907
907
isEnabledByDefault:true,
908
908
description:"A property using [ObservableProperty] returns a byref-like value ([ObservableProperty] must be used on properties of a non byref-like type).",
/// Gets a <see cref="DiagnosticDescriptor"/> for when <c>[ObservableProperty]</c> is used on a property that returns a pointer type.
913
+
/// <para>
914
+
/// Format: <c>"The property {0}.{1} returns a pointer or function pointer value ([ObservableProperty] must be used on properties of a non pointer-like type)"</c>.
title:"Using [ObservableProperty] on a property that returns pointer-like",
920
+
messageFormat:"""The property {0}.{1} returns a pointer or function pointer value ([ObservableProperty] must be used on properties of a non pointer-like type)""",
description:"A property using [ObservableProperty] returns a pointer-like value ([ObservableProperty] must be used on properties of a non pointer-like type).",
0 commit comments