-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you put a EntrySerialize over a Resource itself and also use it in one of the properties, there will be a StackOverflow Exception #341
Conversation
MathoMathiasCamara
commented
Sep 14, 2023
•
edited
Loading
edited
- Added a check to ignore self reference properties
- Added a check to ignore EntrySerializeAttribute from overriding the attribute on the base class.
Added extra check to avoid abstract class getting initialized
9bee1a3
to
ad6c853
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UI shouldn't show even the resource graph if you put entry serialize on the class.
ad6c853
to
1f311cf
Compare
Why don't we just declare that it's not allowed to use |
I have not read the full merge request but: the EntrySerializeAttribute was developed to define it on classes, methods and properties. If you write it on a class, the rules will be applied for the whole class except the member is modified by the attribute itself. You can also declare "Never" on a the class and just add members explicitly. See line 123: https://github.com/PHOENIXCONTACT/MORYX-Framework/blob/dev/src/Moryx/Serialization/EntrySerializeSerialization.cs As I remember: The Resource-Type declares EntrySerialize(Never). This should not be overridden by the developer. https://github.com/PHOENIXCONTACT/MORYX-Framework/blob/dev/src/Moryx.AbstractionLayer/Resources/Resource.cs |
We should defenitly prohibit the override. For MORYX 8 we could even forbid it on the level of attribute declaration. There is an option "AllowMultiple = false". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep in mind, there is a dedicated EntrySerializeSerialization. We should not change the behavior of the DefaultSerialization.
Instead we should isolate this either as a double declaration check in EntrySerializeSerialization and just checking for EntrySerizalize in ResourceSerialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of changing the behavior, just improve the code that reads the class property. This should give preference to the base class declaration over the incorrect override.
For MORYX 8 I suggest we declare the attribute to prohibit duplicate declaration.
Edit: A definition on derived types can not be prohibited. That means we just change the code to give preference to the base class.
f692b02
to
784f97c
Compare
784f97c
to
e2dcc8a
Compare
1f696cb
to
6948a5d
Compare
6948a5d
to
1aa6a40
Compare