Repository navigation
Feature/optimize 03 string write maxlength fix - #13
Merged
jogibear9988 merged 3 commits intoOct 7, 2026
Merged
jogibear9988 merged 3 commits into
jogibear9988 merged 3 commits into
Conversation
…r lists (GML-1187)
Port net functional changes from fork package 01 (DataTypes extension / string array fix, commits 6aef271/519cdeb/ffe8daa): - PlcTag: add virtual GetValue()/SetValue(object) reflecting the concrete tag's public Value property, for generic tag value access. - POffsetInfoType: add virtual MaxStringLength(), returning 0 by default, UnspecifiedOffsetinfo1 for Array1Dim (string array max length), and Min(UnspecifiedOffsetinfo1, UnspecifiedOffsetinfo2) for String (fixes cases where firmware swaps both fields). All other changes from this fork package are already superseded by the target repo's own PlcTag/PlcTags implementation and are documented as excluded in package 16.
…ING/WSTRING writes to fail
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
String serialization, public API compatibility, and concurrent TLS processing still have unresolved correctness issues.
Review effort: Balanced
Findings: 1
Open (5)
What changed in this PR
This PR carries PLC-declared string limits through tag resolution and caching to correct string-write sizing.
Changes:
- Propagates string limits and persists them in version-3 catalogs.
- Adds generic value accessors and string-length regression tests.
- Synchronizes OpenSSL pending-queue access.
| File | Description |
|---|---|
| src/S7CommPlusDriver/S7CommPlusTagAccessorCatalog.cs | Persists and restores string limits. |
| src/S7CommPlusDriver/S7CommPlusProtocolSession.cs | Passes limits into resolved tags. |
| src/S7CommPlusDriver/OpenSSL/OpenSSLConnector.cs | Adds pending-queue locks. |
| src/S7CommPlusDriver/Core/POffsetInfoType.cs | Exposes string-length metadata. |
| src/S7CommPlusDriver/ClientApi/PlcTags.cs | Applies limits during tag creation. |
| src/S7CommPlusDriver/ClientApi/PlcTag.cs | Exposes limits and generic value accessors. |
| src/S7CommPlusDriver/ClientApi/Browser.cs | Includes string limits in browse results. |
| src/S7CommPlusDriver.Tests/PlcTagStringMaxLengthTests.cs | Tests factory limits and scalar string payloads. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+36
to
+37
| private readonly object m_readListLock = new object(); | ||
| private readonly object m_writeListLock = new object(); |
| /// </param> | ||
| /// <returns>The matching concrete tag implementation, or <see langword="null"/> for an unsupported datatype.</returns> | ||
| public static PlcTag TagFactory(string name, ItemAddress address, uint softdatatype, bool Is1Dim = false) | ||
| public static PlcTag TagFactory(string name, ItemAddress address, uint softdatatype, bool Is1Dim = false, int maxStringLength = 0) |
Author
There was a problem hiding this comment.
i think this is not really relevant
Comment on lines
+137
to
+139
| var stringMaxLength = maxStringLength > 0 && maxStringLength <= byte.MaxValue | ||
| ? (byte)maxStringLength | ||
| : (byte)254; |
| var wstringMaxLength = maxStringLength > 0 && maxStringLength <= ushort.MaxValue | ||
| ? (ushort)maxStringLength | ||
| : (ushort)254; | ||
| return new PlcTagWString(name, address, softdatatype, wstringMaxLength); |
Comment on lines
+551
to
+552
| // For a string array, UnspecifiedOffsetinfo1 carries the maximum string length of the array elements. | ||
| public override int MaxStringLength() { return UnspecifiedOffsetinfo1; } |
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.


Contains the sources from branch feature/optimize-02