fix(twincat): update BrowseSymbolsAsync doc + cache adapter fields + Flat-mode note (review)

- ITwinCATClient.BrowseSymbolsAsync XML doc updated: states the implementation now
  expands struct/UDT/FB symbols into atomic member leaves via TwinCATSymbolExpander;
  callers receive only atomic/array leaves with full InstancePaths, never struct containers.
- AdsSymbolNode: cache IsStruct, Mapped, Children, ReadOnly as readonly fields computed
  once in the ctor so repeated property access during recursive expansion doesn't
  re-materialize or re-invoke MapSymbolType/IsSymbolWritable.
- BrowseSymbolsAsync: add operator-gated live risk note next to SymbolsLoadMode.Flat
  warning that a real TC3 target may not populate SubSymbols in Flat mode, with
  guidance to switch to VirtualTree if members don't surface — do not change mode now.
- TwinCATSymbolExpanderTests: simplify confusing `new string('.', 0)` no-op to `""`.
This commit is contained in:
Joseph Doherty
2026-06-17 20:22:45 -04:00
parent 0f929ae668
commit fdd6b332fe
3 changed files with 42 additions and 15 deletions
@@ -104,7 +104,7 @@ public sealed class TwinCATSymbolExpanderTests
// atomic leaf at the very bottom. The leaf sits at depth == number-of-struct-levels.
// Place the leaf at depth MaxDepth (== one past the deepest descended level) so it is dropped,
// and a sibling leaf at a shallow depth so we prove the walk itself still works.
ITwinCATSymbolNode deep = Atomic("Root" + new string('.', 0) + "Leaf.Deep", TwinCATDataType.DInt);
ITwinCATSymbolNode deep = Atomic("RootLeaf.Deep", TwinCATDataType.DInt);
// Wrap the atomic in MaxDepth struct levels so the atomic ends up at depth == MaxDepth.
for (var i = 0; i < TwinCATSymbolExpander.MaxDepth; i++)
deep = Struct($"Level{i}", deep);