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

Made some property-getters within serializable classes public as othe… #1

Closed

Conversation

fgollas
Copy link

@fgollas fgollas commented Oct 25, 2019

…rwise there was a deserialization issue (NullRefException) when integrating the nuget within a net48 project and deserializing a Model

…rwise there was a deserialization issue (NullRefException) when integrating the nuget within a net48 project and deserializing a Model
@adamecr
Copy link
Owner

adamecr commented Oct 26, 2019

Hello @fgollas, these property-getters are intentionally private - the idea is to use them just by XML deserializer, but the parser access them using other properties with some logic:

  • AllowedValues.Values instead of .Text
  • DecisionTable.HitPolicy instead of .HitPolicySrc and .Aggregation instead of .AggregationSrc
  • InformationRequirement.RequirementType and .Ref encapsulating .RequiredDecision and .RequiredInput

I'll try the case "nuget package with net48 project" (the test project use the project reference, so there might be a bit different behavior) later on to check for the exception and the root cause. If positive (meaning erroneous), I'll have to think a bit how to "mask" these source XML props

@adamecr
Copy link
Owner

adamecr commented Oct 26, 2019

first quick look - nuget package + netcore21 project works fine - tests passed. However nuget package + net 472 failed as described.
Will have a look on the deserialization. Frankly, I didn't work with "full" .net framework for a while :-)

Edit:
it seems that in net core, the XmlSerializer may be valid for deserialization only - may not have public getters. For net framework the check is both for readable and writable properties.

I can imagine using IXmlSerializable for AllowedValues class, but I don't like the idea for the others, at these are quite complex.

I'll keep digging, not quite happy with making the props public

@fgollas
Copy link
Author

fgollas commented Oct 26, 2019

@adamecr: Thank you for investigating.

@adamecr
Copy link
Owner

adamecr commented Oct 27, 2019

@fgollas : finally I decided to move forward with IXmlSerializable and proxy classes where needed.
You can have a look in tst-pullreq1 branch - the first commit in branch (I have also added the net framework test project in the second commit and updated packages in the third one)

I'll do some more testing and publish the patch (merge to master + package) later on and then close this pull request.

@adamecr
Copy link
Owner

adamecr commented Nov 3, 2019

@fgollas - v0.1.1 released.
The issues has been fixed using different approach that in this PR (proxy classes instead of "unhiding" the getters), so closing this PR

@adamecr adamecr closed this Nov 3, 2019
@fgollas
Copy link
Author

fgollas commented Nov 29, 2019

thanks alot! Works now for me. Reintegrated your version 0.1.1

@fgollas fgollas deleted the serialization-fix-net48-consumer branch May 25, 2020 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants