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)
}
}
- 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);
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)
// 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)
return _iSymWriter.DefineDocument(url, language, languageVendor, documentType);
}
- public bool IsTransient() => InternalModule.IsTransientInternal();
-
#endregion
#endregion
[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);
#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
#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);
// ===========================================================================
/* 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 *)
{
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();
}
m_pCeeFileGen = NULL;
m_pDynamicMetadata = NULL;
m_fSuppressMetadataCapture = false;
- m_fIsTransient = false;
}
HRESULT STDMETHODCALLTYPE CreateICeeGen(REFIID riid, void **pCeeGen);
// 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();
#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
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
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
QCFuncElement("GetScopeName", COMModule::GetScopeName)
FCFuncElement("GetTypes", COMModule::GetTypes)
QCFuncElement("GetFullyQualifiedName", COMModule::GetFullyQualifiedName)
- QCFuncElement("nIsTransientInternal", COMModule::IsTransient)
FCFuncElement("IsResource", COMModule::IsResource)
FCFuncEnd()
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
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));
}
}
- public string Signature
- {
- get
- {
- return "constructor signature";
- }
- }
-
public ParameterBuilder DefineParameter(int iSequence, ParameterAttributes attributes, string? strParamName)
{
// The 0th ParameterBuilder does not correspond to an
iattrs = attributes;
}
- public Module GetModule()
- {
- return type.Module;
- }
-
public override Module Module
{
get
{
- return GetModule();
+ return type.Module;
}
}
get { return call_conv; }
}
- // FIXME: "Not implemented"
- public string Signature
- {
- get
- {
- throw new NotImplementedException();
- }
- }
-
/* Used by mcs */
internal bool BestFitMapping
{
return type.RuntimeResolve().GetMethod(this);
}
- public Module GetModule()
+ internal Module GetModule()
{
return type.Module;
}
}
}
- public bool IsTransient()
- {
- return true;
- }
-
public void CreateGlobalFunctions()
{
if (global_type_created != null)
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;
}