-
Notifications
You must be signed in to change notification settings - Fork 47
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
EnableImplicitTypingFromAll breaks EnableReferences #397
Comments
Issue-Label Bot is automatically applying the label Links: app homepage, dashboard and code for this bot. |
Doh, |
A quick note here that I have been able to reproduce this with your provided code. Thank you for providing it. It appears that the object graph gets serialized properly, but in reading it in something gets grumpy. I will attempt to look further into this but this appears to be another ugly one involving |
Alright tracked this one down. The issue stems from work done to fix #341 which had problems with references being applied to attribute values, which made no sense. So what I did was make a quick check for an identifier being used, which signifies an element node and not an attribute node. Unless 😅 you are using an extensible formatting system that allows you to have implicit typing for particular elements. So I basically fixed one issue while introducing another. If I can find some way of denoting an attribute node then we should be able to address this. I believe I went with the identifier route as probing the We'll see how this goes. |
Unfortunately the solution I had in mind won't work. This actually isn't an attribute/node problem but a context/scoping problem, which fundamentally is caused by our inner-content reader which has always posed some challenges. As I mentioned, we're doing (or I thought we were doing) some checking to see if the node is in an "attribute node" but really what it's doing is checking the current "identifier" or In a typical document this value is set. However, with implicit typing enabled, it's not and instead returning an empty string, and that is what is throwing the reader for a loop at present. I will give this some more thought, but it is not looking too pretty ATM. One final try/thought/attempt is to perhaps force the As per #383 I am giving issues a fair shake but if they involve a lot of work and/or disruption I will have to defer until a simpler solution emerges and/or someone can submit a PR that does my thinking for me. 😁 Marking this issue as |
Hmm can't say I really grasp the underlying issue here, but is there a way to I'd like to keep the namespaces to a minimum to declutter the document, and this would allow me to not have to specify all types in my call to |
Yeah, the underlying issue is that we have an extensible system that has trouble with its different parts playing nicely with each other. 😁 You could enable implicit typing for everything but This will still emit a namespace at the root node which is the primary utility of using implicit typing, however. The other thing that I thought of, is that we could expose the conditional that is causing the grief here. This isn't much but what it would do is allow you to do is use references + implicit typing, and not references + attributes. You would have to abandon the use of Kind of hacky, but at least it would give you the option of choosing which extensions and functionality you would prefer to use, which is better than what you have now. |
Good news, @gmkado! Turns out I was actually super close yesterday but had overlooked a condition that was previously applied. In reviewing the files I saw my oversight and was able to more specifically check for attributes in the case of references being applied. So now everything should work better for you. Or at least, get us to the next problem. 😆 You can try it out here: I have a passing test demonstrating this here: home/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue397Tests.cs Lines 11 to 46 in 6872b5f
|
Thanks @Mike-E-wins , that fix worked for me as well. You are awesome! Two questions for you:
Is there any way to get rid of the
Thanks again! |
Great! Glad to hear we got something working after all. As for your questions:
|
Nope, I had it backwards, @gmkado ... looks like https://github.com/ExtendedXmlSerializer/home/wiki/Features#object-reference-and-circular-reference
|
Alright @gmkado check out this build: That should have fixes for each of the items that you have identified in this issue, the latest being the I will wait a week in case anything else comes up and then shoot for next Tuesday for a release to NuGet. As for the documentation, it turns out I was right in my understanding, and the unexpected discrepancies were due to a copy/paste error. 😆 However, this should definitely be captured and I have this assigned as #403. |
OK got some further documentation for you @gmkado: I believe that covers everything but
|
Hi @Mike-E-wins , works on my end. Thanks for updating the documentation! |
Great! We'll circle for next Tuesday for a release to NuGet. In the meantime, you can use the preview feed for the latest version which will be used as the deployed version:
(The above should ™ work, please let me know if you run into any problems and I will look into it for you. 👍) |
The fixes here have been deployed to v3.2.0 on NuGet: https://www.nuget.org/packages/ExtendedXmlSerializer/ Here's hoping we didn't break anything else. 😆 Thank you for helping to make ExtendedXmlSerializer a better product!
|
Hi @Mike-E-wins I think v3.2.1 broke the references in v3.2.0 somehow. My reference Ids aren't being read in properly anymore, instead they are being set to a new GUID every time. I don't have time to dig into it right now, but I can lightswitch the issue by switching back and forth between the two versions. |
Pressing this one here right now: 😝
|
Sort of a bummer/surprise because we have passing tests around this. I'm becoming nervous around this issue as it can cause breaking changes with deployed code, as already demonstrated by #407, which kind of freaked me out. 😆 When I first approached this issue, I tried to fix it by addressing it with extensions. We might end up doing this and reverting the changes here if it continues to cause problems. Anyways, if you can find a simple reproduction/code/document that exposes the problem I will take a look into it for you. 👍 |
Hey @Mike-E-wins I'm doing my own reference resolving after deserialization, so I likely won't come back to this. Just FYI in case you want to close the issue. |
OK cool @gmkado I was wondering about that! If you do run into any issues again for sure let me know and I will look into it for you. Having context/test/code would be ideal as well. 👍 Thanks for the update! |
I'm new to this library so still playing around with how ConfigurationContainer works. Apologies if this is the intended behavior.
Here's a simplified version of my data structures:
And here is my container
I would expect all
SubDTO
objects inMainDTO
to be different objects that hold a reference to the sameSubSubDTO
object.Here is the output
This looks right, at least they reference the correct ids. But when I deserialize it,
Sub1
is correct but the other two have new Guids.I tracked down the culprit to this line:
If I take this out, all works as expected.
Another strange thing, if
MainDTO
references SubSubDTO directly (instead of the middle object) it works fine, even when enabling implicit typing for all types.The text was updated successfully, but these errors were encountered: