diff --git a/Design/Rule0026ToolTipPunctuation.cs b/Design/Rule0026ToolTipPunctuation.cs index 4657550a..13b9a4fc 100644 --- a/Design/Rule0026ToolTipPunctuation.cs +++ b/Design/Rule0026ToolTipPunctuation.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Immutable; +using System.Collections.Immutable; using Microsoft.Dynamics.Nav.CodeAnalysis; using Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics; using Microsoft.Dynamics.Nav.CodeAnalysis.Syntax; @@ -18,15 +17,13 @@ private void AnalyzeToolTipPunctuation(SyntaxNodeAnalysisContext ctx) if (ctx.ContainingSymbol.IsObsoletePending || ctx.ContainingSymbol.IsObsoleteRemoved) return; if (ctx.ContainingSymbol.GetContainingObjectTypeSymbol().IsObsoletePending || ctx.ContainingSymbol.GetContainingObjectTypeSymbol().IsObsoleteRemoved) return; - PropertySyntax tooltipProperty = ctx.Node.GetProperty("ToolTip"); - - if (tooltipProperty != null) - { - string tooltipValue = tooltipProperty.Value.GetText().ToString(); - if (!tooltipValue.EndsWith(".'")) - ctx.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.Rule0026ToolTipPunctuation, tooltipProperty.GetLocation())); - } + PropertyValueSyntax tooltipProperty = ctx.Node.GetPropertyValue(PropertyKind.ToolTip); + if (tooltipProperty == null) + return; + StringLiteralValueSyntax tooltipLabel = ((LabelPropertyValueSyntax)tooltipProperty).Value.LabelText; + if (!tooltipLabel.Value.ToString().EndsWith(".'")) + ctx.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.Rule0026ToolTipPunctuation, tooltipProperty.GetLocation())); } } } \ No newline at end of file