Merged
Conversation
Closed
Emit AXSharp.Connector.EnumeratorDiscriminatorAttribute on generated POCO properties representing enum and named value types. Update CsPlainSourceBuilder to generate this attribute, and regenerate .g.cs files to include it. Bump AXSharp.Abstractions and AXSharp.Connector package versions to support the new attribute. This improves metadata for reflection and tooling.
…ing types for enums; update CsPlainSourceBuilder for global attribute usage.
…ed Members section
- Enhance GetPropertyValue to detect and handle malformed pragmas, returning an empty string on error. - Adjust error messages to use 1-based line numbers for clarity. - Reorder grammar rules for correct pragma parsing precedence. - Minor formatting and copyright updates.
Introduced PragmaParserTests covering property, attribute, setter, and generic pragma parsing, as well as error handling and edge cases. Added PragmaMock for IPragma and used NSubstitute for IDeclaration mocking. This significantly improves test coverage and robustness for pragma parsing.
ConstructIdentitiesAsync now uses _identitiesTags directly, bypassing ReadIdentitiesAsync. SortIdentitiesAsync performs an async batch read of identity keys and uses LastValue directly for sorting, removing synchronous calls for improved performance. Minor formatting change to DuplicateIdentityException.
Improved safety by adding an explicit null check for _connector before calling ReadBatchAsync in SortIdentitiesAsync. This change clarifies intent and prevents potential null reference issues.
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.
This pull request introduces a significant new feature to the AXSharp compiler: automatic generation of typed enum accessor properties for PLC enum and named value types with integral backing types. This enhancement improves type safety and usability in generated C# code, and is accompanied by documentation updates and some minor dependency and code improvements.
The most important changes are:
Typed Enum Accessor Properties:
StatusEnum) for properties based on PLCENUMtypes and named value types with integral backing types, allowing direct access to enum values without manual casting. [1] [2] [3] [4] [5] [6][EnumeratorDiscriminatorAttribute]to support serialization and UI features, and this is also reflected in POCO types. [1] [2]Documentation Updates:
ADDED_MEMBERS.mddocumenting the new typed enum accessor properties, usage examples, and important notes on reading values.Compiler Helper Improvements:
HasIntegralBackingTypeto detect if a named value type has an integral base, used to determine when to generate typed enum accessors.Pragma and Error Handling Improvements:
Dependency Updates:
Google.Protobuf,Siemens.Simatic.S7.Webserver.API, andMicrosoft.Extensions.DependencyInjection.Abstractionsto newer versions. [1] [2] [3]closes #510
closes #386
closes #455