Open
Conversation
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.
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 automatic generation of strongly-typed enum accessor properties for PLC enum-based and named value-based properties in the C# code generated by the AXSharp compiler. It also improves the handling and annotation of these enum properties, updates documentation, and makes minor fixes in pragma parsing and diagnostics.
Typed Enum Accessor Properties and Annotations
StatusEnum) for properties based on PLCENUMtypes and named value types with integral backing types. These accessors allow direct, type-safe access to enum values without manual casting. [1] [2] [3] [4] [5][EnumeratorDiscriminatorAttribute]to maintain enum type information for serialization and UI support in both onliner and POCO classes. [1] [2]Documentation Updates
ADDED_MEMBERS.mdandREADME.md) has been updated to describe the new typed enum accessor property feature, including usage examples, scenarios, and important notes about reading values. [1] [2]Pragma Parsing and Diagnostics
Tests and Examples
Miscellaneous
These changes collectively enhance developer ergonomics, type safety, and code clarity when working with PLC enums and named value types in AXSharp-generated C# code.
closes #510
closes #386
closes #455