diff --git a/CHANGELOG.md b/CHANGELOG.md index dfc6561584..13d27e1f47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ Deprecations: - `Castle.Core.Internal.Lock` (class) - `Castle.Core.Internal.ILockHolder` (interface) - `Castle.Core.Internal.IUpgradeableLockHolder` (interface) +- You should no longer manually emit types into DynamicProxy's dynamic assembly. For this reason, the following member has been deprecated. (@stakx, #445) + - `Castle.DynamicProxy.ModuleScope.DefineType` (method) - The proxy type cache in `ModuleScope` should no longer be accessed directly. For this reason, the members listed below have been deprecated. (@stakx, #391) - `Castle.DynamicProxy.ModuleScope.Lock` (property) - `Castle.DynamicProxy.ModuleScope.GetFromCache` (method) diff --git a/ref/Castle.Core-net35.cs b/ref/Castle.Core-net35.cs index 683955f681..45830c8c3c 100644 --- a/ref/Castle.Core-net35.cs +++ b/ref/Castle.Core-net35.cs @@ -2647,6 +2647,7 @@ public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule, Castle.D public System.Reflection.Emit.ModuleBuilder WeakNamedModule { get; } public string WeakNamedModuleDirectory { get; } public string WeakNamedModuleName { get; } + [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Reflection.Emit.TypeBuilder DefineType(bool inSignedModulePreferably, string name, System.Reflection.TypeAttributes flags) { } [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Type GetFromCache(Castle.DynamicProxy.Generators.CacheKey key) { } diff --git a/ref/Castle.Core-net40.cs b/ref/Castle.Core-net40.cs index 8925f59cde..0af1511a6f 100644 --- a/ref/Castle.Core-net40.cs +++ b/ref/Castle.Core-net40.cs @@ -2694,6 +2694,7 @@ public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule, Castle.D public System.Reflection.Emit.ModuleBuilder WeakNamedModule { get; } public string WeakNamedModuleDirectory { get; } public string WeakNamedModuleName { get; } + [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Reflection.Emit.TypeBuilder DefineType(bool inSignedModulePreferably, string name, System.Reflection.TypeAttributes flags) { } [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Type GetFromCache(Castle.DynamicProxy.Generators.CacheKey key) { } diff --git a/ref/Castle.Core-net45.cs b/ref/Castle.Core-net45.cs index 85474a0316..564abab055 100644 --- a/ref/Castle.Core-net45.cs +++ b/ref/Castle.Core-net45.cs @@ -2694,6 +2694,7 @@ public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule, Castle.D public System.Reflection.Emit.ModuleBuilder WeakNamedModule { get; } public string WeakNamedModuleDirectory { get; } public string WeakNamedModuleName { get; } + [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Reflection.Emit.TypeBuilder DefineType(bool inSignedModulePreferably, string name, System.Reflection.TypeAttributes flags) { } [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Type GetFromCache(Castle.DynamicProxy.Generators.CacheKey key) { } diff --git a/ref/Castle.Core-netstandard1.3.cs b/ref/Castle.Core-netstandard1.3.cs index 5ad6decc87..d6a2471e6a 100644 --- a/ref/Castle.Core-netstandard1.3.cs +++ b/ref/Castle.Core-netstandard1.3.cs @@ -1543,6 +1543,7 @@ public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule, Castle.D public string StrongNamedModuleName { get; } public System.Reflection.Emit.ModuleBuilder WeakNamedModule { get; } public string WeakNamedModuleName { get; } + [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Reflection.Emit.TypeBuilder DefineType(bool inSignedModulePreferably, string name, System.Reflection.TypeAttributes flags) { } [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Type GetFromCache(Castle.DynamicProxy.Generators.CacheKey key) { } diff --git a/ref/Castle.Core-netstandard1.5.cs b/ref/Castle.Core-netstandard1.5.cs index fba6d0a371..caabc0f2ab 100644 --- a/ref/Castle.Core-netstandard1.5.cs +++ b/ref/Castle.Core-netstandard1.5.cs @@ -1543,6 +1543,7 @@ public ModuleScope(bool savePhysicalAssembly, bool disableSignedModule, Castle.D public string StrongNamedModuleName { get; } public System.Reflection.Emit.ModuleBuilder WeakNamedModule { get; } public string WeakNamedModuleName { get; } + [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Reflection.Emit.TypeBuilder DefineType(bool inSignedModulePreferably, string name, System.Reflection.TypeAttributes flags) { } [System.ObsoleteAttribute("Exposes a component that is intended for internal use only.")] public System.Type GetFromCache(Castle.DynamicProxy.Generators.CacheKey key) { } diff --git a/src/Castle.Core/DynamicProxy/ModuleScope.cs b/src/Castle.Core/DynamicProxy/ModuleScope.cs index e9f1a47b42..2ae9de52dc 100644 --- a/src/Castle.Core/DynamicProxy/ModuleScope.cs +++ b/src/Castle.Core/DynamicProxy/ModuleScope.cs @@ -573,6 +573,8 @@ public void LoadAssemblyIntoCache(Assembly assembly) } #endif + [Obsolete("Exposes a component that is intended for internal use only.")] // TODO: Redeclare this method as `internal`. + [EditorBrowsable(EditorBrowsableState.Never)] public TypeBuilder DefineType(bool inSignedModulePreferably, string name, TypeAttributes flags) { var module = ObtainDynamicModule(disableSignedModule == false && inSignedModulePreferably);