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
Prevent double GetObjectData
implementation for badly implemented serializable classes
#554
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stakx
commented
Jan 6, 2021
src/Castle.Core/DynamicProxy/Contributors/ClassProxySerializableContributor.cs
Show resolved
Hide resolved
src/Castle.Core/DynamicProxy/Contributors/ClassProxyWithTargetTargetContributor.cs
Show resolved
Hide resolved
src/Castle.Core/DynamicProxy/Contributors/ClassProxySerializableContributor.cs
Outdated
Show resolved
Hide resolved
jonorossi
requested changes
Jan 19, 2021
src/Castle.Core/DynamicProxy/Contributors/ClassProxySerializableContributor.cs
Outdated
Show resolved
Hide resolved
src/Castle.Core/DynamicProxy/Contributors/ClassProxyWithTargetTargetContributor.cs
Show resolved
Hide resolved
src/Castle.Core/DynamicProxy/Contributors/ClassProxySerializableContributor.cs
Outdated
Show resolved
Hide resolved
stakx
force-pushed
the
bad-serializables
branch
2 times, most recently
from
January 19, 2021 19:08
b4bc444
to
afb5ebb
Compare
An overridable `GetObjectData` method inside a `[Serializable]` class that does not implement `ISerializable` can be handled in two ways: 1. It can be overridden as part of the `ISerializable` implementation that DynamicProxy provides for `[Serializable]` classes. 2. It can be proxied regularly, like any other overridable method. Unfortunately, at this time, DynamicProxy does both, i.e. it produces two `GetObjectData` methods with identical signature in the same proxy type, which causes verification failure. The correct behavior is (1): The `ISerializable` implementation should take precedence over any method proxying, even though proxied methods are emitted first. (Thus the need for "the trick with methodsToSkip"!)
stakx
force-pushed
the
bad-serializables
branch
from
January 20, 2021 06:31
afb5ebb
to
87b6e58
Compare
jonorossi
approved these changes
Jan 20, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #367. As an additional bonus, gets rid of this:
Core/src/Castle.Core/DynamicProxy/Generators/BaseClassProxyGenerator.cs
Line 112 in 9143de2
See commit messages and code comments for details.