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

preserveObjectReferences can result in InvalidCastException #96

Closed
zbynek001 opened this issue May 21, 2018 · 2 comments · Fixed by #97
Closed

preserveObjectReferences can result in InvalidCastException #96

zbynek001 opened this issue May 21, 2018 · 2 comments · Fixed by #97
Labels

Comments

@zbynek001
Copy link
Contributor

when Uri is serialized with preserveObjectReferences and versionTolerance enabled, deserialization will fail with InvalidCastException.

It happens like this. During serialization,

  • SerializerSession will track Uri itself
  • Uri contains the url itself in several fields as string
  • it'll try to serialize the string value
  • session.TryGetObjectId will find the previous object, unfortunatelly it won't be string, but Uri
  • Later, during deserialization, this will result in InvalidCastException

Reason is, that SerializerSession is using default equality comparer for tracked objects and string and Uri are equal, when having the same value.

@Horusiath
Copy link
Contributor

Possible duplicate of #85 ?

@zbynek001
Copy link
Contributor Author

Not sure, but I'd say it's not the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants