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
Serialize not filtering properties correctly in .NET Standard #246
Comments
@prettyv Could you please have another look at these changes which seam to be the cause for this issue. |
Yes, reverting that commit resolves the issue. and the pattern searched for after does not match "mscorlib." (dot in the end differs). |
Note that there's a differences between .NET (Core) and Framework. |
The unit tests for the sample code above succeed. So it looks like your environment is different. But still, the dot after "mscorlib." in YAXLib/YAXLib/ReflectionUtils.cs Line 836 in c757b6b
should be removed, meaning the comparison should be the same as here: YAXLib/YAXLib/ReflectionUtils.cs Line 839 in c757b6b
Although assembly names may contain dots, this does not apply for "mscorlib.dll". Never mind your environment: Do I understand correctly that just removing the dot after "mscorlib" would fix the issue? |
Yes, removing the dot should do the trick. Given a bit of tweaking you'll probably see this error in a bunch of unit tests too.
After this you'll most likely see tests failing in the same manner originally stated. |
Okay, very good. There will be a new release in 1-2 days. |
Correct filtering for properties that are part of the .NET framework, when the runtime framework is not the same as the YAXLib target framework (e.g. reference to NetStandard2.0 from NET481). Update unit test packages * Nunit 3.13.3 * NUinit3TestAdapter 4.3.1 * FluentAssertions 6.8.0 * Microsoft.NET.Test.Sdk 17.4.1
Closes #246: Correct filtering for properties that are part of the .NET framework, when the runtime framework is not the same as the YAXLib target framework (e.g. reference to NetStandard2.0 from NET481). Update unit test packages Nunit 3.13.3 NUinit3TestAdapter 4.3.1 FluentAssertions 6.8.0 Microsoft.NET.Test.Sdk 17.4.1 Convert NUnit Classic Assert to the Constraint model, Add package reference NUnit.Analyzers
YAXLib version: 4.2.0
Framework version: .NET Standard 2.0 (in runtime .NET Framework 4.8) and .NET Standard 2.1 (in Unity version of Mono in Unity 2022.3.22)
This code
First results in XML like
and then throws in Deserialize() with
YAXLib.Exceptions.YAXBadlyFormedInput: 'The format of the value specified for the property 'IsReadOnly' is not proper: 'false'.'
Adding the SerializerOptions
ExceptionHandlingPolicies = YAXExceptionHandlingPolicies.DoNotThrow
Keeps Deserialize() from throwing but the deserialized result variable contains seven ints instead of the expected four.
The issue seems to have been introduced in c0bb561
The text was updated successfully, but these errors were encountered: