Remove serialization support in DynamicProxy #512
Closed
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.
I am making this a draft to prevent accidental merging (although it's mostly ready); after all, we haven't decided yet whether to keep or retire serialization support in DynamicProxy. Until that time, consider this an "exploration" to help us better understand serialization in DynamicProxy.
This PR is perhaps best reviewed commit by commit, for the following reason:
#501 (comment) gave a summary of the different usages of
FEATURE_SERIALIZATION
in DynamicProxy, and appears to have been largely correct. I used it as a guideline to "undo" serialization from DynamicProxy, in the following order:Make all exception types serializable across all targets.(Update: Moved into a separate PR Make all exception types serializable #515.)Change DynamicProxy so generated proxy and invocation types are no longer serializable. (
Those two kinds of generated types cannot be easily done piecemeal because they share a common base class,Incorrect: Invocation type generators ultimately subtypeBaseProxyGenerator
.IGenerator<T>
, notBaseProxyGenerator
.)Finally, abandon
LoadAssemblyIntoCache
and get rid of the requirement that "supporting types" (hooks, interceptors, interceptor selectors, mixins) should be made serializable.The net result is that DynamicProxy code no longer makes use of
FEATURE_SERIALIZATION
—the remaining usages are inside DictionaryAdapter and the logging facility.Closes #367.