Make most of DynamicProxy's internals internal
#505
Merged
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.
We've been talking about making internals truly
internal
(see e.g. #389) so that we can more easily refactor in the future. This PR is my initial attempt at doing so for DynamicProxy.What this PR does not do is change type names or namespaces. The latter might make sense in some cases (e.g. moving
AttributesToAvoidReplicating
into DynamicProxy's main namespaceCastle.DynamicProxy
, or perhaps combining all exception types into a singleDynamicProxyException
type). I would personally favor such changes, but they are left to future PRs.Compatiblity checks for downstream libraries
Windsor
Windsor will be able to update without any major changes. Those are the main required changes that I have identified:
Its single use of
DelegateProxyGenerator
will have to be replaced withProxyGenerationOptions.AddDelegateTypeMixin
. This is straightforward, as demonstrated in the unit tests in one of this PR's commits.(Unrelated to this PR, but since we're discussing Windsor:) It makes use of the
Lock
APIs in approx. 15 places. The easiest solution would be to migrate theLock
API over into Windsor from an older version of Castle.Core (but make it internal). The slightly more laborious solution would be to change allLock
usages to useReaderWriterLockSlim
directly. (This latter approach is definitely possible, but not as straightforward as it may seem because theLock
API implements some kind of reentrancy on top of non-reentrantReaderWriterLockSlim
instances.)(Unrelated to this PR:) Windsor targets some frameworks that we no longer support here (e.g.
net40
), those will have to be dropped.FakeItEasy, Moq 4, and NSubstitute
The API removals do not cause any problems for these three libraries. (I've checked by compiling them against this PR's version of Castle.Core. The only problem is unrelated to this PR—some of these libraries will only be able to update after removing their
netstandard1.x
targets, which we stopped supporting in #495.)