Giter Site home page Giter Site logo

Comments (13)

create-issue-branch avatar create-issue-branch commented on June 3, 2024

Branch issues/fix/i609 created!

from home.

Mike-E-angelo avatar Mike-E-angelo commented on June 3, 2024

Hey there @RashmiBK5 thank you for writing in and for reporting this. There should not be any breaking changes for minor versions so this appears to be a bug. I will look into this for you and see what happened. 👍

from home.

Mike-E-angelo avatar Mike-E-angelo commented on June 3, 2024

Alright I spent some time looking into this for you @RashmiBK5 and please do pardon my confusion as I didn't realize when 3.2.x was released as it was back in 2020. To be honest I am not sure how well I will be able to support you here.

Nonetheless I did try to load your code with these versions, but there does not appear to be neither an IXmlConfiguration<T> nor an IConfigurationContainer.Configure that supports it.

If you are able to provide code that better illustrates the issue I can try seeing what I can do here.

from home.

RashmiBK5 avatar RashmiBK5 commented on June 3, 2024

ConsoleApp1.zip

I have updated the code, could you please check.
But in sample application base configuration is never considered in 3.2.3.

from home.

Mike-E-angelo avatar Mike-E-angelo commented on June 3, 2024

Thank you @RashmiBK5. I appreciate you creating a project. If you are further able to post it as a repository I would greatly appreciate it. I am not a fan of zips as they are a security consideration.

from home.

RashmiBK5 avatar RashmiBK5 commented on June 3, 2024

code is available in
https://github.com/RashmiBK5/ExtendedXML

GitHub
Contribute to RashmiBK5/ExtendedXML development by creating an account on GitHub.

from home.

Mike-E-angelo avatar Mike-E-angelo commented on June 3, 2024

Thank you very much for that @RashmiBK5 and for your understanding. 🙏 Looking into this now for you.

from home.

Mike-E-angelo avatar Mike-E-angelo commented on June 3, 2024

Alright @RashmiBK5 I see that IXmlConfiguration is a custom class but I unfortunately fail to see how you are configuring it. I tried using the code you initially reported, but it results in errors:

image

Can you update the repository with the code you opened the ticket with?

from home.

RashmiBK5 avatar RashmiBK5 commented on June 3, 2024

I have updated the Code, now you should be able to run the code https://github.com/RashmiBK5/ExtendedXML

version 3.2.3


<? xml version = "1.0" encoding = "utf-8" ?>
< Details xmlns = "clr-namespace:;assembly=ConsoleApp1" >
   < Description > test </ Description >
   < Objects xmlns: sys = "https://extendedxmlserializer.github.io/system" xmlns: exs = "https://extendedxmlserializer.github.io/v2" exs: type = "sys:List[BaseClass]" >
       < Capacity > 4 </ Capacity >
       < DerivedClass >
           < IsSelected > false </ IsSelected >
           < Property2 > Property2 </ Property2 >
       </ DerivedClass >
       < DerivedClass2 >
           < IsSelected > false </ IsSelected >
           < Property3 > Property3 </ Property3 >
       </ DerivedClass2 >
   </ Objects >
</ Details >

version 3.2.4 onwards


<? xml version = "1.0" encoding = "utf-8" ?>
< Details xmlns = "clr-namespace:;assembly=ConsoleApp1" >
   < Description > test </ Description >
   < Objects xmlns: sys = "https://extendedxmlserializer.github.io/system" xmlns: exs = "https://extendedxmlserializer.github.io/v2" exs: type = "sys:List[BaseClass]" >
       < Capacity > 4 </ Capacity >
       < DerivedClass >
           < Property1 > BaseDerivedClass1 </ Property1 >
           < IsSelected > false </ IsSelected >
           < Property2 > Property2 </ Property2 >
       </ DerivedClass >
       < DerivedClass2 >
           < Property1 > BaseDerivedClass2 </ Property1 >
           < IsSelected > false </ IsSelected >
           < Property3 > Property3 </ Property3 >
       </ DerivedClass2 >
   </ Objects >
</ Details >

from home.

Mike-E-angelo avatar Mike-E-angelo commented on June 3, 2024

Thank you very much for your provided information @RashmiBK5. I have isolated this to #416 and while all the tests passed at the time, you're right here I should have put more thought into the change as technically it is breaking. What we need is some way of assigning the preferred member comparer, or maybe some other fix for this. I'll continue to think about it.

from home.

Mike-E-angelo avatar Mike-E-angelo commented on June 3, 2024

Hi @RashmiBK5 unfortunately I have not been able to figure out a good solution for you, or at least one that I can incorporate into the codebase as a PR after a few hours of investigation. I've tried a few approaches but all of them result in broken tests.

The class in question that is causing this issue is MemberComparer:

sealed class MemberComparer : IMemberComparer

I have several suggestions:

  1. Repeat the member configurations on all types (yuck, I know)
  2. Attempt to create a PR with a fix in MemberComparer above that addresses your issues and passes all existing tests.
  3. Fork this repository and use a special build of ExtendedXmlSerializer, using the code below to replace MemberComparer. This worked for all tests except for one, which I was not able to dertermine why in the time I spent in it:
using System.Reflection;

namespace ExtendedXmlSerializer.ReflectionModel
{
	sealed class MemberComparer : IMemberComparer
	{
		public static MemberComparer Default { get; } = new MemberComparer();

		MemberComparer() : this(Defaults.TypeComparer) {}

		readonly ITypeComparer _type;

		public MemberComparer(ITypeComparer type) => _type = type;

		public bool Equals(MemberInfo x, MemberInfo y)
			=> x.Name.Equals(y.Name) &&
			   (_type.Equals(x.ReflectedType.GetTypeInfo(), y.ReflectedType.GetTypeInfo()) ||
			    x.ReflectedType.IsAssignableFrom(y.DeclaringType));

		public int GetHashCode(MemberInfo obj) => 0;
	}
}

I wish I could assist more but unfortunately my time is limited these days. Please see #383 for more information. Please let me know of any further questions you may have and I will further assist you.

from home.

RashmiBK5 avatar RashmiBK5 commented on June 3, 2024

Thanks a lot @Mike-E-angelo

What should I do to get the fix as part of Nuget package. I want the fix to be added to version 3.7.6.

And will the same fix be added to latest version as well? in future when we Upgrade to latest version, I will face same issue.

from home.

Mike-E-angelo avatar Mike-E-angelo commented on June 3, 2024

Hi @RashmiBK5 thank you for your continued collaboration. Getting this into the official package is the tricky part, as when I attempted to do so I could not get all tests to pass.

So the idea here is to submit a Pull Request that fixes this issue while ensuring all tests as written pass. I would then review it and if it looks OK, accept it and create a new NuGet package from there.

If this is something you are interested in participating in, I can help/support you through the process.

Please note that this might take some time as it has been a while since the last release and there are some considerations to account for, one of which is to generate a new publishing key on NuGet as the last one expired.

from home.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.