diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs index 5eea3c9dae6da..6f34f7dcef5f4 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs @@ -305,10 +305,6 @@ internal static AssemblyBuilder InternalDefineDynamicAssembly( public ModuleBuilder DefineDynamicModule(string name) => DefineDynamicModuleInternal(name, emitSymbolInfo: false); - [DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod. - public ModuleBuilder DefineDynamicModule(string name, bool emitSymbolInfo) => - DefineDynamicModuleInternal(name, emitSymbolInfo); - private ModuleBuilder DefineDynamicModuleInternal(string name, bool emitSymbolInfo) { lock (SyncRoot) diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs index 0e608f73bdf9b..a9875ebdaf4f2 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs @@ -160,18 +160,11 @@ public override CallingConventions CallingConvention } } - public Module GetModule() - { - return m_methodBuilder.GetModule(); - } - internal override Type GetReturnType() { return m_methodBuilder.ReturnType; } - public string Signature => m_methodBuilder.Signature; - public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { m_methodBuilder.SetCustomAttribute(con, binaryAttribute); diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs index 6811eb598bf8c..e2df0f5313ece 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs @@ -758,13 +758,11 @@ public bool InitLocals set { ThrowIfGeneric(); m_fInitLocals = value; } } - public Module GetModule() + internal Module GetModule() { return GetModuleBuilder(); } - public string Signature => GetMethodSignature().ToString(); - public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { if (con is null) diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs index 7989225a58501..c1c243b8d0230 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs @@ -1598,20 +1598,6 @@ public void SetCustomAttribute(CustomAttributeBuilder customBuilder) // Regardless, this is a reliability bug. internal ISymbolWriter? GetSymWriter() => _iSymWriter; - public ISymbolDocumentWriter? DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType) - { - // url cannot be null but can be an empty string - if (url == null) - { - throw new ArgumentNullException(nameof(url)); - } - - lock (SyncRoot) - { - return DefineDocumentNoLock(url, language, languageVendor, documentType); - } - } - private ISymbolDocumentWriter? DefineDocumentNoLock(string url, Guid language, Guid languageVendor, Guid documentType) { if (_iSymWriter == null) @@ -1623,8 +1609,6 @@ public void SetCustomAttribute(CustomAttributeBuilder customBuilder) return _iSymWriter.DefineDocument(url, language, languageVendor, documentType); } - public bool IsTransient() => InternalModule.IsTransientInternal(); - #endregion #endregion diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs index 8f65ca6a66c96..a85a2226265b8 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs @@ -17,9 +17,6 @@ internal class RuntimeModule : Module [DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] private static extern void GetType(QCallModule module, string className, bool throwOnError, bool ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive); - [DllImport(RuntimeHelpers.QCall)] - private static extern bool nIsTransientInternal(QCallModule module); - [DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] private static extern void GetScopeName(QCallModule module, StringHandleOnStack retString); @@ -382,12 +379,6 @@ public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFile #region Internal Members internal RuntimeType RuntimeType => m_runtimeType ??= ModuleHandle.GetModuleType(this); - internal bool IsTransientInternal() - { - RuntimeModule thisAsLocal = this; - return RuntimeModule.nIsTransientInternal(new QCallModule(ref thisAsLocal)); - } - internal MetadataImport MetadataImport => ModuleHandle.GetMetadataImport(this); #endregion diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index 9d4cd4ab7ce45..9ef8f08ff9656 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -176,7 +176,7 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat #ifndef CROSSGEN_COMPILE if (GetManifestFile()->IsDynamic()) // manifest modules of dynamic assemblies are always transient - m_pManifest = ReflectionModule::Create(this, GetManifestFile(), pamTracker, REFEMIT_MANIFEST_MODULE_NAME, TRUE); + m_pManifest = ReflectionModule::Create(this, GetManifestFile(), pamTracker, REFEMIT_MANIFEST_MODULE_NAME); else #endif m_pManifest = Module::Create(this, mdFileNil, GetManifestFile(), pamTracker); diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index a41ed4c81a593..c5a9d98ac6e4e 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -12442,7 +12442,7 @@ idMethodSpec Module::LogInstantiatedMethod(const MethodDesc * md, ULONG flagNum) // =========================================================================== /* static */ -ReflectionModule *ReflectionModule::Create(Assembly *pAssembly, PEFile *pFile, AllocMemTracker *pamTracker, LPCWSTR szName, BOOL fIsTransient) +ReflectionModule *ReflectionModule::Create(Assembly *pAssembly, PEFile *pFile, AllocMemTracker *pamTracker, LPCWSTR szName) { CONTRACT(ReflectionModule *) { @@ -12468,9 +12468,6 @@ ReflectionModule *ReflectionModule::Create(Assembly *pAssembly, PEFile *pFile, A pModule->DoInit(pamTracker, szName); - // Set this at module creation time. The m_fIsTransient field should never change during the lifetime of this ReflectionModule. - pModule->SetIsTransient(fIsTransient ? true : false); - RETURN pModule.Extract(); } @@ -12498,7 +12495,6 @@ ReflectionModule::ReflectionModule(Assembly *pAssembly, mdFile token, PEFile *pF m_pCeeFileGen = NULL; m_pDynamicMetadata = NULL; m_fSuppressMetadataCapture = false; - m_fIsTransient = false; } HRESULT STDMETHODCALLTYPE CreateICeeGen(REFIID riid, void **pCeeGen); diff --git a/src/coreclr/vm/ceeload.h b/src/coreclr/vm/ceeload.h index 13a78ec96f4ef..81116102682c6 100644 --- a/src/coreclr/vm/ceeload.h +++ b/src/coreclr/vm/ceeload.h @@ -3210,9 +3210,6 @@ class ReflectionModule : public Module // This is used to allow bulk emitting types without re-emitting the metadata between each type. bool m_fSuppressMetadataCapture; - // If true, then only other transient modules can depend on this module. - bool m_fIsTransient; - #if !defined DACCESS_COMPILE && !defined CROSSGEN_COMPILE // Returns true iff metadata capturing is suppressed bool IsMetadataCaptureSuppressed(); @@ -3244,7 +3241,7 @@ class ReflectionModule : public Module #endif #if !defined DACCESS_COMPILE && !defined CROSSGEN_COMPILE - static ReflectionModule *Create(Assembly *pAssembly, PEFile *pFile, AllocMemTracker *pamTracker, LPCWSTR szName, BOOL fIsTransient); + static ReflectionModule *Create(Assembly *pAssembly, PEFile *pFile, AllocMemTracker *pamTracker, LPCWSTR szName); void Initialize(AllocMemTracker *pamTracker, LPCWSTR szName); void Destruct(); #endif // !DACCESS_COMPILE && !CROSSGEN_COMPILE @@ -3296,20 +3293,6 @@ class ReflectionModule : public Module return &m_pISymUnmanagedWriter; } - bool IsTransient() - { - LIMITED_METHOD_CONTRACT; - - return m_fIsTransient; - } - - void SetIsTransient(bool fIsTransient) - { - LIMITED_METHOD_CONTRACT; - - m_fIsTransient = fIsTransient; - } - #ifndef DACCESS_COMPILE #ifndef CROSSGEN_COMPILE diff --git a/src/coreclr/vm/commodule.cpp b/src/coreclr/vm/commodule.cpp index 2ac2b03392e9a..f1ac719c5046a 100644 --- a/src/coreclr/vm/commodule.cpp +++ b/src/coreclr/vm/commodule.cpp @@ -704,28 +704,6 @@ void QCALLTYPE COMModule::SetModuleName(QCall::ModuleHandle pModule, LPCWSTR wsz END_QCALL; } -//****************************************************************************** -// -// Return a type spec token given a byte array -// -//****************************************************************************** -BOOL QCALLTYPE COMModule::IsTransient(QCall::ModuleHandle pModule) -{ - QCALL_CONTRACT; - - BOOL fIsTransient = FALSE; - - BEGIN_QCALL; - - /* Only reflection modules can be transient */ - if (pModule->IsReflection()) - fIsTransient = pModule->GetReflectionModule()->IsTransient(); - - END_QCALL; - - return fIsTransient; -} - //****************************************************************************** // // Return a type spec token given a byte array diff --git a/src/coreclr/vm/ecalllist.h b/src/coreclr/vm/ecalllist.h index 738ac9a339977..3ca90d4bbc400 100644 --- a/src/coreclr/vm/ecalllist.h +++ b/src/coreclr/vm/ecalllist.h @@ -324,7 +324,6 @@ FCFuncStart(gCOMModuleFuncs) QCFuncElement("GetScopeName", COMModule::GetScopeName) FCFuncElement("GetTypes", COMModule::GetTypes) QCFuncElement("GetFullyQualifiedName", COMModule::GetFullyQualifiedName) - QCFuncElement("nIsTransientInternal", COMModule::IsTransient) FCFuncElement("IsResource", COMModule::IsResource) FCFuncEnd() diff --git a/src/libraries/System.Reflection.Emit/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.Reflection.Emit/src/MatchingRefApiCompatBaseline.txt index 65344a30607c4..5bee5254aabcc 100644 --- a/src/libraries/System.Reflection.Emit/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.Reflection.Emit/src/MatchingRefApiCompatBaseline.txt @@ -1,10 +1,3 @@ Compat issues with assembly System.Reflection.Emit: -MembersMustExist : Member 'public System.Reflection.Emit.ModuleBuilder System.Reflection.Emit.AssemblyBuilder.DefineDynamicModule(System.String, System.Boolean)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public System.Reflection.Module System.Reflection.Emit.ConstructorBuilder.GetModule()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public System.String System.Reflection.Emit.ConstructorBuilder.Signature.get()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public System.Reflection.Module System.Reflection.Emit.MethodBuilder.GetModule()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public System.String System.Reflection.Emit.MethodBuilder.Signature.get()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public System.Diagnostics.SymbolStore.ISymbolDocumentWriter System.Reflection.Emit.ModuleBuilder.DefineDocument(System.String, System.Guid, System.Guid, System.Guid)' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'protected System.ModuleHandle System.Reflection.Emit.ModuleBuilder.GetModuleHandleImpl()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public System.Boolean System.Reflection.Emit.ModuleBuilder.IsTransient()' does not exist in the reference but it does exist in the implementation. -Total Issues: 8 +Total Issues: 1 diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs index 502d09d152da4..0c1d75229cf95 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs @@ -254,9 +254,7 @@ public static AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyB return ab; } - public ModuleBuilder DefineDynamicModule(string name) => DefineDynamicModule(name, false); - - public ModuleBuilder DefineDynamicModule(string name, bool emitSymbolInfo) + public ModuleBuilder DefineDynamicModule(string name) { if (name == null) throw new ArgumentNullException(nameof(name)); diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs index 0afee6f41f318..9ef7217e81f1c 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs @@ -209,14 +209,6 @@ public override string Name } } - public string Signature - { - get - { - return "constructor signature"; - } - } - public ParameterBuilder DefineParameter(int iSequence, ParameterAttributes attributes, string? strParamName) { // The 0th ParameterBuilder does not correspond to an @@ -313,16 +305,11 @@ public void SetImplementationFlags(MethodImplAttributes attributes) iattrs = attributes; } - public Module GetModule() - { - return type.Module; - } - public override Module Module { get { - return GetModule(); + return type.Module; } } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs index be43137a10153..18c4a47f7225b 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs @@ -184,15 +184,6 @@ public override CallingConventions CallingConvention get { return call_conv; } } - // FIXME: "Not implemented" - public string Signature - { - get - { - throw new NotImplementedException(); - } - } - /* Used by mcs */ internal bool BestFitMapping { @@ -278,7 +269,7 @@ internal MethodBase RuntimeResolve() return type.RuntimeResolve().GetMethod(this); } - public Module GetModule() + internal Module GetModule() { return type.Module; } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs index bc0b59413b812..86ba437fa1028 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs @@ -118,11 +118,6 @@ public override string FullyQualifiedName } } - public bool IsTransient() - { - return true; - } - public void CreateGlobalFunctions() { if (global_type_created != null) @@ -596,8 +591,6 @@ internal int GetTypeToken(Type type) throw new ArgumentNullException(nameof(type)); if (type.IsByRef) throw new ArgumentException("type can't be a byref type", nameof(type)); - if (!IsTransient() && (type.Module is ModuleBuilder) && ((ModuleBuilder)type.Module).IsTransient()) - throw new InvalidOperationException("a non-transient module can't reference a transient module"); return type.MetadataToken; }