// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-
-//*************************************************************************************************************
+//
// For each dynamic assembly there will be two AssemblyBuilder objects: the "internal"
// AssemblyBuilder object and the "external" AssemblyBuilder object.
// 1. The "internal" object is the real assembly object that the VM creates and knows about. However,
// "internal" object.
//
// "internal" and "external" ModuleBuilders are similar
-//*************************************************************************************************************
+//
namespace System.Reflection.Emit
{
}
#endregion
}
-
- // AssemblyBuilder class.
- // deliberately not [serializable]
+
public sealed class AssemblyBuilder : Assembly
{
#region FCALL
/// to have a strong name and a hash will be computed when the assembly
/// is saved.
/// </summary>
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod.
public static AssemblyBuilder DefineDynamicAssembly(
AssemblyName name,
AssemblyBuilderAccess access)
return InternalDefineDynamicAssembly(name, access,
ref stackMark, null);
}
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod.
public static AssemblyBuilder DefineDynamicAssembly(
AssemblyName name,
AssemblyBuilderAccess access,
/// modules within an Assembly with the same name. This dynamic module is
/// a transient module.
/// </summary>
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod.
public ModuleBuilder DefineDynamicModule(
string name)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return DefineDynamicModuleInternal(name, false, ref stackMark);
}
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+
+ /// <param name = "name" ></ param >
+ /// <param name = "emitSymbolInfo" >Specify if emit symbol info or not.</ param >
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod.
public ModuleBuilder DefineDynamicModule(
string name,
- bool emitSymbolInfo) // specify if emit symbol info or not
+ bool emitSymbolInfo)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return DefineDynamicModuleInternal(name, emitSymbolInfo, ref stackMark);
#endregion
#region Assembly overrides
- // Returns the names of all the resources
+ /// <returns>The names of all the resources.</returns>
public override string[] GetManifestResourceNames()
{
return InternalAssembly.GetManifestResourceNames();
}
}
- // Override the EntryPoint method on Assembly.
- // This doesn't need to be synchronized because it is simple enough
+ /// <sumary>
+ /// Override the EntryPoint method on Assembly.
+ /// This doesn't need to be synchronized because it is simple enough.
+ /// </sumary>
public override MethodInfo EntryPoint
{
get
}
}
- // Get an array of all the public types defined in this assembly
+ /// <sumary>
+ /// Get an array of all the public types defined in this assembly.
+ /// </sumary>
public override Type[] GetExportedTypes()
{
return InternalAssembly.GetExportedTypes();
{
return InternalAssembly.GetLoadedModules(getResourceModules);
}
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod.
public override Assembly GetSatelliteAssembly(CultureInfo culture)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return InternalAssembly.InternalGetSatelliteAssembly(culture, null, ref stackMark);
}
- // Useful for binding to a very specific version of a satellite assembly
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ /// <sumary>
+ /// Useful for binding to a very specific version of a satellite assembly
+ /// </sumary>
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod.
public override Assembly GetSatelliteAssembly(CultureInfo culture, Version version)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
public override bool IsCollectible => InternalAssembly.IsCollectible;
#endregion
-
-
- /// <summary>
- /// return a dynamic module with the specified name.
- /// </summary>
+
+ /// <param name="name">The name of module for the look up.</param>
+ /// <returns>Dynamic module with the specified name.</returns>
public ModuleBuilder GetDynamicModule(
- string name) // the name of module for the look up
+ string name)
{
lock (SyncRoot)
{
}
}
+ /// <param name="name">The name of module for the look up.</param>
private ModuleBuilder GetDynamicModuleNoLock(
- string name) // the name of module for the look up
+ string name)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
return null;
}
-
/// <summary>
- /// Use this function if client decides to form the custom attribute blob themselves
+ /// Use this function if client decides to form the custom attribute blob themselves.
/// </summary>
public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
{
m_assemblyData.AddCustomAttribute(con, binaryAttribute);
}
}
-
+
/// <summary>
- /// Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder
+ /// Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder.
/// </summary>
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-
namespace System.Reflection.Emit
{
using System;
using System.Runtime.Versioning;
using System.Diagnostics.SymbolStore;
- // This is a package private class. This class hold all of the managed
- // data member for AssemblyBuilder. Note that what ever data members added to
- // this class cannot be accessed from the EE.
+ /// <summary>
+ /// This is a package private class. This class hold all of the managed
+ /// data member for AssemblyBuilder. Note that what ever data members added to
+ /// this class cannot be accessed from the EE.
+ /// </summary>
internal class AssemblyBuilderData
{
internal AssemblyBuilderData(
m_peFileKind = PEFileKinds.Dll;
}
-
- // Helper to add a dynamic module into the tracking list
+
+ /// <summary>
+ /// Helper to add a dynamic module into the tracking list.
+ /// </summary>
internal void AddModule(ModuleBuilder dynModule)
{
m_moduleBuilderList.Add(dynModule);
}
-
- // Helper to track CAs to persist onto disk
+ /// <summary>
+ /// Helper to track CAs to persist onto disk.
+ /// </summary>
internal void AddCustomAttribute(CustomAttributeBuilder customBuilder)
{
// make sure we have room for this CA
m_iCABuilder++;
}
-
- // Helper to track CAs to persist onto disk
+
+ /// <summary>
+ /// Helper to track CAs to persist onto disk.
+ /// </summary>
internal void AddCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
{
// make sure we have room for this CA
m_CACons[m_iCAs] = con;
m_iCAs++;
}
-
- // Helper to ensure the type name is unique underneath assemblyBuilder
+
+ /// <summary>
+ /// Helper to ensure the type name is unique underneath assemblyBuilder.
+ /// </summary>
internal void CheckTypeNameConflict(string strTypeName, TypeBuilder enclosingType)
{
for (int i = 0; i < m_moduleBuilderList.Count; i++)
internal bool m_OverrideUnmanagedVersionInfo;
}
-
/// <summary>
/// Internal structure to track the list of ResourceWriter for
/// AssemblyBuilder & ModuleBuilder.