fix fails to write string longer than declared in controller#530
Merged
PTKu merged 6 commits intoJun 12, 2026
Merged
Conversation
PTKu
commented
Jun 12, 2026
Contributor
- test(connector): add failing tests for string write capacity normalization
- fix(connector): truncate string writes to declared capacity
- test(compiler): add failing golden fixture for declared string capacities
- feat(compiler): emit declared string capacity into generated twins
- test(connector): add live-PLC E2E tests for string capacity truncation
NormalizeString passed values <=254 chars through untouched and truncated longer values to Capacity-1 with Capacity defaulting to 0, which threw ArgumentOutOfRangeException. Cyclic write path skipped normalization entirely. Shared helper now truncates to declared capacity exactly (fallback 254 when capacity unknown) on SetAsync, cyclic and peek paths, and logs a warning on truncation.
ixc discarded STRING[n]/WSTRING[n] capacity, so runtime twins never knew the declared size (Capacity stayed 0). Constructor builders now emit `.Capacity = n;` after every string factory call (254 when undeclared), including configuration globals and arrays of strings.
Adds STRING[10]/WSTRING[10] vars to ax-test-project and verifies boundary writes (9/10/11 chars) over SetAsync and cyclic paths plus the 300-char write to a default STRING against real hardware. Drops the manual Capacity workaround in the primitive test base since generated twins now carry declared capacity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.