Skip to content
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

Default Content for Lists and Implicit Collection-based Child Element Support via XmlElementAttribute #240

Closed
Mike-E-angelo opened this issue Feb 27, 2019 · 3 comments
Assignees
Labels
enhancement (cc: feat) New feature or request wontfix This will not be worked on

Comments

@Mike-E-angelo
Copy link
Member

This has popped up now several times with #229 and #239 and is becoming a bit of a headache as it is not an easy fix. Essentially, we differ from the classic serializer when the XmlElement is applied to a property. The problem is that we do not have any easy way of establishing a property context when an unexpected property name is encountered.

Well, actually, the real problem is that I have a very difficult time working with XmlReader and XmlWriter (while keeping everything performant), so it takes me a while to wrangle my emotions around these suckers. 😂

I will have to give this some thought, but the last time I looked into this it was going to be disruptive.

@Mike-E-angelo Mike-E-angelo added enhancement (cc: feat) New feature or request help wanted Extra attention is needed labels Feb 27, 2019
@Mike-E-angelo Mike-E-angelo changed the title Default Content (for Lists) Default Content for Lists and Implicit Collection-based Child Element Support via XmlElementAttribute Feb 27, 2019
@Mike-E-angelo Mike-E-angelo changed the title Default Content for Lists and Implicit Collection-based Child Element Support via XmlElementAttribute Default Content for Lists and Implicit Collection-based Child Element Support via XmlElementAttribute Feb 27, 2019
@Mike-E-angelo Mike-E-angelo pinned this issue May 17, 2019
@Mike-E-angelo
Copy link
Member Author

Gah, this is such a brutal item. I've been taking a look around this one for the past several days -- what feels like a week 😆 -- and still have no idea of the best way to tackle it. The work done on #192 is actually a good blueprint. Maybe I will be able to work with it.

I hate that this is really the only item that we haven't been able to resolve. So, time to resolve it. :P

@Mike-E-angelo Mike-E-angelo self-assigned this Jul 17, 2019
@Mike-E-angelo Mike-E-angelo added this to the v2.1.22 milestone Jul 17, 2019
@Mike-E-angelo
Copy link
Member Author

Mike-E-angelo commented Jul 17, 2019

Hah... actually, it's kinda funny as I just now realized that the EnableXmlText (#192) does pretty much everything required to make this work. I can't believe I didn't see this earlier -- I really checked out of this issue. 😆

I should have this addressed sometime today or tomorrow. 👍 Let's see how I do. :P

Mike-E-angelo added a commit that referenced this issue Jul 18, 2019
Mike-E-angelo added a commit that referenced this issue Jul 18, 2019
…ix for complex graphs with current infrastructure.
@Mike-E-angelo Mike-E-angelo removed this from the v2.1.22 milestone Jul 18, 2019
@Mike-E-angelo Mike-E-angelo added wontfix This will not be worked on and removed help wanted Extra attention is needed labels Jul 18, 2019
@Mike-E-angelo
Copy link
Member Author

Mike-E-angelo commented Jul 18, 2019

Egads, what a mess.

I was able to get this working somewhat. If the object being serialized contains the list being serialized/deserialized, and that those list items are the last elements in the entire document, then this works.

Example:
https://github.com/wojtpl2/ExtendedXmlSerializer/blob/3b3288983b511ff20d5ed3306ffb2d06e3471cf1/test/ExtendedXmlSerializer.Tests/ReportedIssues/Issue240Tests.cs#L27-L41

However, if the object is contained within another object, then it doesn't. Example:
https://github.com/wojtpl2/ExtendedXmlSerializer/blob/3b3288983b511ff20d5ed3306ffb2d06e3471cf1/test/ExtendedXmlSerializer.Tests/ReportedIssues/Issue240Tests.cs#L43-L59

Based on the current infrastructure (and the sheer amount of time I have spent), I am marking this scenario as not-possible/won't-fix for v2. The best we can do is point future developers who would like this functionality and see if the above works for them. The other (only) way to fix this is a complete rewrite of the functionality, which is what I am already doing with v3.

Sorry all. I tried. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement (cc: feat) New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant