mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-23 10:23:13 +08:00
aef86ba9dc
## Summary Adds write-validation for the standard OPC UA `SelectionListType` VariableType via the handwritten `SelectionListState` partial, plus unit tests. Split out of #4220 into its own PR against `master`. ## The feature `SelectionListState` overrides `WriteValueAttribute` to enforce **OPC UA Part 5 section 7.18**: when the optional `RestrictToList` property is present and `true`, a written value must be one of the entries in the mandatory `Selections` property. Behavior contract: - Validation **gates on `RestrictToList`** — only enforced when the property is present and true. Otherwise the base-class behavior applies unchanged. - **Empty `Selections` rejects all** values (nothing is a valid member). - Membership is **data-type independent** — determined via `Variant` equality rather than any specific built-in type. - **Mismatched built-in types defer to the base class** for its normal type validation. The generated `SelectionListState` partial (base `BaseDataVariableState`, typed `Selections`/`SelectionDescriptions`/`RestrictToList` properties) is produced by the source generator from the core address space; this handwritten partial supplies only the write-validation override, using a single clean generic helper. ## Validation - Build `Opc.Ua.Core.Types` (net10.0, Release): **0 warnings, 0 errors**. - `SelectionListStateTests` (net10.0, Release): **14 passed, 0 failed**. --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>