Skip to content

Commit 9c35dc0

Browse files
committed
Fix formatting in field reference diagnostic message
1 parent 35e3584 commit 9c35dc0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/CommunityToolkit.Mvvm.SourceGenerators/Diagnostics/Analyzers/FieldReferenceForObservablePropertyFieldAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override void Initialize(AnalysisContext context)
4141
SymbolEqualityComparer.Default.Equals(attributeClass, attributeSymbol))
4242
{
4343
// Emit a warning to redirect users to access the generated property instead
44-
context.ReportDiagnostic(Diagnostic.Create(FieldReferenceForObservablePropertyFieldWarning, context.Operation.Syntax.GetLocation(), fieldSymbol.ContainingType, fieldSymbol));
44+
context.ReportDiagnostic(Diagnostic.Create(FieldReferenceForObservablePropertyFieldWarning, context.Operation.Syntax.GetLocation(), fieldSymbol));
4545

4646
return;
4747
}

src/CommunityToolkit.Mvvm.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
using System.ComponentModel;
66
using Microsoft.CodeAnalysis;
7-
using Microsoft.CodeAnalysis.CSharp;
87

98
#pragma warning disable IDE0090 // Use 'new DiagnosticDescriptor(...)'
109

@@ -547,13 +546,13 @@ internal static class DiagnosticDescriptors
547546
/// <summary>
548547
/// Gets a <see cref="DiagnosticDescriptor"/> indicating when a field with <c>[ObservableProperty]</c> is being directly referenced.
549548
/// <para>
550-
/// Format: <c>"The field {0}.{1} is annotated with [ObservableProperty] and should not be directly referenced (use the generated property instead)"</c>.
549+
/// Format: <c>"The field {0} is annotated with [ObservableProperty] and should not be directly referenced (use the generated property instead)"</c>.
551550
/// </para>
552551
/// </summary>
553552
public static readonly DiagnosticDescriptor FieldReferenceForObservablePropertyFieldWarning = new DiagnosticDescriptor(
554553
id: "MVVMTK0034",
555554
title: "Invalid task scheduler exception flow option usage",
556-
messageFormat: "The field {0}.{1} is annotated with [ObservableProperty] and should not be directly referenced (use the generated property instead)",
555+
messageFormat: "The field {0} is annotated with [ObservableProperty] and should not be directly referenced (use the generated property instead)",
557556
category: typeof(ObservablePropertyGenerator).FullName,
558557
defaultSeverity: DiagnosticSeverity.Warning,
559558
isEnabledByDefault: true,

0 commit comments

Comments
 (0)