From 96e3c391b380a78fda66239b42a395e1a69be6ce Mon Sep 17 00:00:00 2001 From: Rafael Date: Fri, 26 Oct 2018 00:34:32 -0700 Subject: [PATCH] Working towards clean-up comments /**/ in cs (dotnet/coreclr#20609) * Working towards cleaning comments /**/ Cleaningup /**/ style comments - Following https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/recommended-tags-for-documentation-comments dotnet/coreclr#20330 * Updating tags -Updating some to -Adding missing tags * Fixing PR comments -Comment does not belong to the public description * Hiding comment from public description. * Update //***** to the prevalent // style. Commit migrated from https://github.com/dotnet/coreclr/commit/3ed48433718f870cdf258ac10bcd6eead6beb2b9 --- .../src/System/Reflection/Emit/AssemblyBuilder.cs | 67 +++++++++++----------- .../System/Reflection/Emit/AssemblyBuilderData.cs | 36 ++++++------ 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs index 872398f..06ed8d1 100644 --- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs +++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs @@ -2,8 +2,7 @@ // 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, @@ -20,7 +19,7 @@ // "internal" object. // // "internal" and "external" ModuleBuilders are similar -//************************************************************************************************************* +// namespace System.Reflection.Emit { @@ -136,9 +135,7 @@ namespace System.Reflection.Emit } #endregion } - - // AssemblyBuilder class. - // deliberately not [serializable] + public sealed class AssemblyBuilder : Assembly { #region FCALL @@ -277,7 +274,7 @@ namespace System.Reflection.Emit /// to have a strong name and a hash will be computed when the assembly /// is saved. /// - [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) @@ -286,8 +283,8 @@ namespace System.Reflection.Emit 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, @@ -333,18 +330,20 @@ namespace System.Reflection.Emit /// modules within an Assembly with the same name. This dynamic module is /// a transient module. /// - [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 + + /// + /// Specify if emit symbol info or not. + [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); @@ -474,7 +473,7 @@ namespace System.Reflection.Emit #endregion #region Assembly overrides - // Returns the names of all the resources + /// The names of all the resources. public override string[] GetManifestResourceNames() { return InternalAssembly.GetManifestResourceNames(); @@ -529,8 +528,10 @@ namespace System.Reflection.Emit } } - // Override the EntryPoint method on Assembly. - // This doesn't need to be synchronized because it is simple enough + /// + /// Override the EntryPoint method on Assembly. + /// This doesn't need to be synchronized because it is simple enough. + /// public override MethodInfo EntryPoint { get @@ -539,7 +540,9 @@ namespace System.Reflection.Emit } } - // Get an array of all the public types defined in this assembly + /// + /// Get an array of all the public types defined in this assembly. + /// public override Type[] GetExportedTypes() { return InternalAssembly.GetExportedTypes(); @@ -614,16 +617,18 @@ namespace System.Reflection.Emit { 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 + /// + /// 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. public override Assembly GetSatelliteAssembly(CultureInfo culture, Version version) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; @@ -640,13 +645,11 @@ namespace System.Reflection.Emit public override bool IsCollectible => InternalAssembly.IsCollectible; #endregion - - - /// - /// return a dynamic module with the specified name. - /// + + /// The name of module for the look up. + /// Dynamic module with the specified name. public ModuleBuilder GetDynamicModule( - string name) // the name of module for the look up + string name) { lock (SyncRoot) { @@ -654,8 +657,9 @@ namespace System.Reflection.Emit } } + /// The name of module for the look up. private ModuleBuilder GetDynamicModuleNoLock( - string name) // the name of module for the look up + string name) { if (name == null) throw new ArgumentNullException(nameof(name)); @@ -674,9 +678,8 @@ namespace System.Reflection.Emit return null; } - /// - /// 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. /// public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -708,9 +711,9 @@ namespace System.Reflection.Emit m_assemblyData.AddCustomAttribute(con, binaryAttribute); } } - + /// - /// Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder + /// Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder. /// public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilderData.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilderData.cs index 68cb783..e2f38a2 100644 --- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilderData.cs +++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilderData.cs @@ -2,10 +2,6 @@ // 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; @@ -19,9 +15,11 @@ namespace System.Reflection.Emit 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. + /// + /// 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. + /// internal class AssemblyBuilderData { internal AssemblyBuilderData( @@ -37,15 +35,18 @@ namespace System.Reflection.Emit m_peFileKind = PEFileKinds.Dll; } - - // Helper to add a dynamic module into the tracking list + + /// + /// Helper to add a dynamic module into the tracking list. + /// internal void AddModule(ModuleBuilder dynModule) { m_moduleBuilderList.Add(dynModule); } - - // Helper to track CAs to persist onto disk + /// + /// Helper to track CAs to persist onto disk. + /// internal void AddCustomAttribute(CustomAttributeBuilder customBuilder) { // make sure we have room for this CA @@ -63,8 +64,10 @@ namespace System.Reflection.Emit m_iCABuilder++; } - - // Helper to track CAs to persist onto disk + + /// + /// Helper to track CAs to persist onto disk. + /// internal void AddCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { // make sure we have room for this CA @@ -93,8 +96,10 @@ namespace System.Reflection.Emit m_CACons[m_iCAs] = con; m_iCAs++; } - - // Helper to ensure the type name is unique underneath assemblyBuilder + + /// + /// Helper to ensure the type name is unique underneath assemblyBuilder. + /// internal void CheckTypeNameConflict(string strTypeName, TypeBuilder enclosingType) { for (int i = 0; i < m_moduleBuilderList.Count; i++) @@ -147,7 +152,6 @@ namespace System.Reflection.Emit internal bool m_OverrideUnmanagedVersionInfo; } - /// /// Internal structure to track the list of ResourceWriter for /// AssemblyBuilder & ModuleBuilder. -- 2.7.4