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

Make ModuleScope internal #557

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Deprecations:
- `Castle.Core.Internal.Lock` (class) along with all related types and methods
- `Castle.Core.Internal.PermissionUtil.IsGranted` (method)
- `Castle.Core.Pair<,>` (type). Use `System.ValueTuple<,>` or `System.Tuple<,>` instead.
- all type members in `Castle.DynamicProxy.ModuleScope` that gave direct access to DynamicProxy's type cache and `ModuleBuilder`s. Only `SaveAssembly`, `LoadAssemblyIntoCache`, and members supporting these two facilities are left public.
- `Castle.DynamicProxy.ModuleScope` (which gave direct access to DynamicProxy's type cache and `ModuleBuilder`s). `SaveAssembly` is available in `PersistentProxyBuilder` on platforms that support saving dynamic assemblies to disk, and `LoadAssemblyIntoCache` is available in `DefaultProxyBuilder`.
- almost all types and type members in the `Castle.DynamicProxy.*` sub-namespaces, as most of them are intended for internal use only.
- DynamicProxy's custom exception types have been replaced by standard BCL exceptions (where appropriate), and by a single `DynamicProxyException` type for internal DynamicProxy errors.

Expand Down
33 changes: 9 additions & 24 deletions ref/Castle.Core-net45.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2495,17 +2495,16 @@ public override bool Equals(object obj) { }
public override int GetHashCode() { }
public static Castle.DynamicProxy.CustomAttributeInfo FromExpression(System.Linq.Expressions.Expression<System.Func<System.Attribute>> expression) { }
}
public class DefaultProxyBuilder : Castle.DynamicProxy.IProxyBuilder
public class DefaultProxyBuilder : Castle.DynamicProxy.IProxyBuilder, Castle.DynamicProxy.IProxyBuilderWithCache
{
public DefaultProxyBuilder() { }
public DefaultProxyBuilder(Castle.DynamicProxy.ModuleScope scope) { }
public Castle.Core.Logging.ILogger Logger { get; set; }
public Castle.DynamicProxy.ModuleScope ModuleScope { get; }
public System.Type CreateClassProxyType(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) { }
public System.Type CreateClassProxyTypeWithTarget(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) { }
public System.Type CreateInterfaceProxyTypeWithTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, System.Type targetType, Castle.DynamicProxy.ProxyGenerationOptions options) { }
public System.Type CreateInterfaceProxyTypeWithTargetInterface(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) { }
public System.Type CreateInterfaceProxyTypeWithoutTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) { }
public void LoadAssemblyIntoCache(System.Reflection.Assembly assembly) { }
}
[System.Serializable]
public sealed class DynamicProxyException : System.Exception { }
Expand Down Expand Up @@ -2547,13 +2546,16 @@ public interface IInvocationProceedInfo
public interface IProxyBuilder
{
Castle.Core.Logging.ILogger Logger { get; set; }
Castle.DynamicProxy.ModuleScope ModuleScope { get; }
System.Type CreateClassProxyType(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateClassProxyTypeWithTarget(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateInterfaceProxyTypeWithTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, System.Type targetType, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateInterfaceProxyTypeWithTargetInterface(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateInterfaceProxyTypeWithoutTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
}
public interface IProxyBuilderWithCache : Castle.DynamicProxy.IProxyBuilder
{
void LoadAssemblyIntoCache(System.Reflection.Assembly assembly);
}
public interface IProxyGenerationHook
{
void MethodsInspected();
Expand Down Expand Up @@ -2632,23 +2634,6 @@ public override int GetHashCode() { }
public object GetMixinInstance(System.Type mixinInterfaceType) { }
public int GetMixinPosition(System.Type mixinInterfaceType) { }
}
public class ModuleScope
{
public static readonly string DEFAULT_ASSEMBLY_NAME;
public static readonly string DEFAULT_FILE_NAME;
public ModuleScope() { }
public ModuleScope(bool savePhysicalAssembly) { }
public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule) { }
public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule, string strongAssemblyName, string strongModulePath, string weakAssemblyName, string weakModulePath) { }
public string StrongNamedModuleDirectory { get; }
public string StrongNamedModuleName { get; }
public string WeakNamedModuleDirectory { get; }
public string WeakNamedModuleName { get; }
public void LoadAssemblyIntoCache(System.Reflection.Assembly assembly) { }
public string SaveAssembly() { }
public string SaveAssembly(bool strongNamed) { }
public static byte[] GetKeyPair() { }
}
public class PersistentProxyBuilder : Castle.DynamicProxy.DefaultProxyBuilder
{
public PersistentProxyBuilder() { }
Expand Down Expand Up @@ -2815,15 +2800,15 @@ public CacheMappingsAttribute(byte[] serializedCacheMappings) { }
public class ProxyObjectReference : System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.IObjectReference, System.Runtime.Serialization.ISerializable
{
protected ProxyObjectReference(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static Castle.DynamicProxy.ModuleScope ModuleScope { get; }
public static Castle.DynamicProxy.IProxyBuilder ProxyBuilder { get; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public object GetRealObject(System.Runtime.Serialization.StreamingContext context) { }
protected void InvokeCallback(object target) { }
public void OnDeserialization(object sender) { }
public object RecreateClassProxy() { }
public object RecreateInterfaceProxy(string generatorType) { }
protected virtual object RecreateProxy() { }
public static void ResetScope() { }
public static void SetScope(Castle.DynamicProxy.ModuleScope scope) { }
public static void ResetProxyBuilder() { }
public static void SetProxyBuilder(Castle.DynamicProxy.IProxyBuilder builder) { }
}
}
18 changes: 2 additions & 16 deletions ref/Castle.Core-netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2461,12 +2461,10 @@ public override bool Equals(object obj) { }
public override int GetHashCode() { }
public static Castle.DynamicProxy.CustomAttributeInfo FromExpression(System.Linq.Expressions.Expression<System.Func<System.Attribute>> expression) { }
}
public class DefaultProxyBuilder : Castle.DynamicProxy.IProxyBuilder
public class DefaultProxyBuilder : Castle.DynamicProxy.IProxyBuilder, Castle.DynamicProxy.IProxyBuilderWithCache
{
public DefaultProxyBuilder() { }
public DefaultProxyBuilder(Castle.DynamicProxy.ModuleScope scope) { }
public Castle.Core.Logging.ILogger Logger { get; set; }
public Castle.DynamicProxy.ModuleScope ModuleScope { get; }
public System.Type CreateClassProxyType(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) { }
public System.Type CreateClassProxyTypeWithTarget(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) { }
public System.Type CreateInterfaceProxyTypeWithTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, System.Type targetType, Castle.DynamicProxy.ProxyGenerationOptions options) { }
Expand Down Expand Up @@ -2513,13 +2511,13 @@ public interface IInvocationProceedInfo
public interface IProxyBuilder
{
Castle.Core.Logging.ILogger Logger { get; set; }
Castle.DynamicProxy.ModuleScope ModuleScope { get; }
System.Type CreateClassProxyType(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateClassProxyTypeWithTarget(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateInterfaceProxyTypeWithTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, System.Type targetType, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateInterfaceProxyTypeWithTargetInterface(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateInterfaceProxyTypeWithoutTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
}
public interface IProxyBuilderWithCache : Castle.DynamicProxy.IProxyBuilder { }
public interface IProxyGenerationHook
{
void MethodsInspected();
Expand Down Expand Up @@ -2598,18 +2596,6 @@ public override int GetHashCode() { }
public object GetMixinInstance(System.Type mixinInterfaceType) { }
public int GetMixinPosition(System.Type mixinInterfaceType) { }
}
public class ModuleScope
{
public static readonly string DEFAULT_ASSEMBLY_NAME;
public static readonly string DEFAULT_FILE_NAME;
public ModuleScope() { }
public ModuleScope(bool savePhysicalAssembly) { }
public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule) { }
public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule, string strongAssemblyName, string strongModulePath, string weakAssemblyName, string weakModulePath) { }
public string StrongNamedModuleName { get; }
public string WeakNamedModuleName { get; }
public static byte[] GetKeyPair() { }
}
public class ProxyGenerationOptions
{
public static readonly Castle.DynamicProxy.ProxyGenerationOptions Default;
Expand Down
18 changes: 2 additions & 16 deletions ref/Castle.Core-netstandard2.1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2461,12 +2461,10 @@ public override bool Equals(object obj) { }
public override int GetHashCode() { }
public static Castle.DynamicProxy.CustomAttributeInfo FromExpression(System.Linq.Expressions.Expression<System.Func<System.Attribute>> expression) { }
}
public class DefaultProxyBuilder : Castle.DynamicProxy.IProxyBuilder
public class DefaultProxyBuilder : Castle.DynamicProxy.IProxyBuilder, Castle.DynamicProxy.IProxyBuilderWithCache
{
public DefaultProxyBuilder() { }
public DefaultProxyBuilder(Castle.DynamicProxy.ModuleScope scope) { }
public Castle.Core.Logging.ILogger Logger { get; set; }
public Castle.DynamicProxy.ModuleScope ModuleScope { get; }
public System.Type CreateClassProxyType(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) { }
public System.Type CreateClassProxyTypeWithTarget(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) { }
public System.Type CreateInterfaceProxyTypeWithTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, System.Type targetType, Castle.DynamicProxy.ProxyGenerationOptions options) { }
Expand Down Expand Up @@ -2513,13 +2511,13 @@ public interface IInvocationProceedInfo
public interface IProxyBuilder
{
Castle.Core.Logging.ILogger Logger { get; set; }
Castle.DynamicProxy.ModuleScope ModuleScope { get; }
System.Type CreateClassProxyType(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateClassProxyTypeWithTarget(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateInterfaceProxyTypeWithTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, System.Type targetType, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateInterfaceProxyTypeWithTargetInterface(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
System.Type CreateInterfaceProxyTypeWithoutTarget(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options);
}
public interface IProxyBuilderWithCache : Castle.DynamicProxy.IProxyBuilder { }
public interface IProxyGenerationHook
{
void MethodsInspected();
Expand Down Expand Up @@ -2598,18 +2596,6 @@ public override int GetHashCode() { }
public object GetMixinInstance(System.Type mixinInterfaceType) { }
public int GetMixinPosition(System.Type mixinInterfaceType) { }
}
public class ModuleScope
{
public static readonly string DEFAULT_ASSEMBLY_NAME;
public static readonly string DEFAULT_FILE_NAME;
public ModuleScope() { }
public ModuleScope(bool savePhysicalAssembly) { }
public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule) { }
public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule, string strongAssemblyName, string strongModulePath, string weakAssemblyName, string weakModulePath) { }
public string StrongNamedModuleName { get; }
public string WeakNamedModuleName { get; }
public static byte[] GetKeyPair() { }
}
public class ProxyGenerationOptions
{
public static readonly Castle.DynamicProxy.ProxyGenerationOptions Default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private static string FindPeVerifyPath()
public abstract class BasePEVerifyTestCase
{
protected ProxyGenerator generator;
protected IProxyBuilder builder;
protected DefaultProxyBuilder builder;

private bool verificationDisabled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void TearDown_SavesAssembly_IfProxyGenerated()

private void FindVerificationErrors()
{
ModuleBuilder moduleBuilder = generator.ProxyBuilder.ModuleScope.ObtainDynamicModule(true);
ModuleBuilder moduleBuilder = builder.ModuleScope.ObtainDynamicModule(true);
TypeBuilder invalidType = moduleBuilder.DefineType("InvalidType");
MethodBuilder invalidMethod = invalidType.DefineMethod("InvalidMethod", MethodAttributes.Public);
invalidMethod.GetILGenerator().Emit(OpCodes.Ldnull); // missing RET statement
Expand Down
Loading