diff --git a/src/ScadaLink.TemplateEngine/Validation/ValidationService.cs b/src/ScadaLink.TemplateEngine/Validation/ValidationService.cs index 514c109..4c81246 100644 --- a/src/ScadaLink.TemplateEngine/Validation/ValidationService.cs +++ b/src/ScadaLink.TemplateEngine/Validation/ValidationService.cs @@ -428,6 +428,18 @@ public class ValidationService while ((index = expression.IndexOf(marker, index, StringComparison.Ordinal)) >= 0) { + // Only treat this as a self-attribute reference when it is not a member + // access. A bare `Attributes["X"]` resolves against the flattened + // configuration; `Children["Pump"].Attributes["X"]` and + // `Parent.Attributes["X"]` are member accesses (preceded by '.') whose + // dotted/composed canonical names cannot be checked against the flat + // self-attribute set — skip them rather than emit a false positive. + if (index > 0 && expression[index - 1] == '.') + { + index += marker.Length; + continue; + } + var cursor = index + marker.Length; // Skip whitespace between '[' and the literal. while (cursor < expression.Length && char.IsWhiteSpace(expression[cursor]))