-
Notifications
You must be signed in to change notification settings - Fork 26
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
Can not serialize/deserialize type with "internal" or "private" modifier #33
Comments
I believe from a dotnet perspective, it's not possible to view type information of a type that is not made public. So it's not possible to view the properties on the object |
@aleksandrkolesnikov What @sanchez wrote is true. Do you have some suggestion on how to retrieve type information for |
This can be done by using the correct BindingFlags. See this commit for an example. I'd be happy to help get this implemented. |
While this should not be the primary consideration, private reflection is a lot less efficient. That's one reason why Newtonsoft has the same 'weakness'. (Pretty sure STJ does too). If this was a perf-oriented impl, one might at a minimum expect this to be an opt-in feature at a minimum... |
@bartelink I wasn't aware of the performance implications, but even if the performance would be equal I think this should not be the default behaviour indeed. An overload that allows this would be quite welcome though. |
I get that; I've been bitten by it too, and it is can be very frustrating, but the fact that this would place this lib on its own in terms of opting people into the cost of private reflection. Flipping a default like this can be considered a breaking change, depending on how you look at it. (Its also possible that there's been perf optimization work done to special case the loading such that you only pay extra cost when they are private - that would probably be something that people would be less surprised by, if it were the case...) |
I am mostly thinking along the lines of adding this as a configuration option which can be used with the |
Hello. When I try to serialize/deserialize Person, I have an exception
But if I remove internal modifier for Person, the code works fine
The text was updated successfully, but these errors were encountered: