diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 96832702367..bd9a411df92 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -4,34 +4,34 @@ #pragma warning disable 1634, 1691 using System; -using System.Diagnostics.CodeAnalysis; -using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; -using System.Reflection; using System.Management.Automation; using System.Management.Automation.Host; using System.Management.Automation.Internal; -using System.Management.Automation.Runspaces; +using System.Management.Automation.Language; using System.Management.Automation.Remoting; -using System.Management.Automation.Security; -using System.Threading; +using System.Management.Automation.Runspaces; +using System.Management.Automation.Tracing; +using System.Reflection; using System.Runtime; using System.Runtime.InteropServices; -using System.Management.Automation.Language; +using System.Text; +using System.Threading; +using System.Threading.Tasks; -using Dbg = System.Management.Automation.Diagnostics; using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle; -using System.Management.Automation.Tracing; -using System.Threading.Tasks; +using Dbg = System.Management.Automation.Diagnostics; +using Debugger = System.Management.Automation.Debugger; + #if LEGACYTELEMETRY using Microsoft.PowerShell.Telemetry.Internal; #endif -using Debugger = System.Management.Automation.Debugger; namespace Microsoft.PowerShell { diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleShell.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleShell.cs index 51db1e5f36c..5f34692cd02 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleShell.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleShell.cs @@ -25,7 +25,7 @@ public static int Start(string bannerText, string helpText, string[] args) return Start(InitialSessionState.CreateDefault2(), bannerText, helpText, args); } - /// Entry point in to ConsoleShell. Used to create a custom Powershell console application + /// Entry point in to ConsoleShell. Used to create a custom Powershell console application. /// InitialSessionState to be used by the ConsoleHost. /// Banner text to be displayed by ConsoleHost. /// Help text for the shell. @@ -49,4 +49,3 @@ public static int Start(InitialSessionState initialSessionState, string bannerTe } } } - diff --git a/src/System.Management.Automation/DscSupport/CimDSCParser.cs b/src/System.Management.Automation/DscSupport/CimDSCParser.cs index 3079155097f..44ca0a7d498 100644 --- a/src/System.Management.Automation/DscSupport/CimDSCParser.cs +++ b/src/System.Management.Automation/DscSupport/CimDSCParser.cs @@ -476,7 +476,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal internal class DscClassCacheEntry { /// - /// Store the RunAs Credentials that this DSC resource will use + /// Store the RunAs Credentials that this DSC resource will use. /// public DSCResourceRunAsCredential DscResRunAsCred; @@ -487,17 +487,17 @@ internal class DscClassCacheEntry public bool IsImportedImplicitly; /// - /// A CimClass instance for this resource + /// A CimClass instance for this resource. /// public Microsoft.Management.Infrastructure.CimClass CimClassInstance; /// - /// Default constructor to initiale variables with default values + /// Initializes variables with default values. /// public DscClassCacheEntry() : this(DSCResourceRunAsCredential.Default, false, null) { } /// - /// Constructor used in code to initialze all values + /// Initializes all values. /// /// /// @@ -547,7 +547,7 @@ public static class DscClassCache /// /// DSC class cache for this runspace. - /// Cache stores the DSCRunAsBehavior, cim class and boolean to indicate if an Inbox resource has been implicitly imported. + /// Cache stores the DSCRunAsBehavior, cim class and boolean to indicate if an Inbox resource has been implicitly imported. /// private static Dictionary ClassCache { @@ -977,6 +977,7 @@ public static List ImportClasses(string path, Tuple m if (ClassCache.TryGetValue(moduleQualifiedResourceName, out cimClassInfo)) { CimClass cimClass = cimClassInfo.CimClassInstance; + // If this is a nested object and we already have exactly same nested object, we will // allow sharing of nested objects. if (!IsSameNestedObject(cimClass, c)) @@ -1005,6 +1006,7 @@ public static List ImportClasses(string path, Tuple m if (resourceList.Count > 0 && !string.IsNullOrEmpty(resourceList[0].Key)) { ClassCache.Remove(resourceList[0].Key); + // keyword is already defined and it is a Inbox resource, remove it if (DynamicKeyword.ContainsKeyword(friendlyName) && resourceList[0].Value.IsImportedImplicitly) { @@ -1077,7 +1079,7 @@ public static void ClearCache() /// private static string GetModuleQualifiedResourceName(string moduleName, string moduleVersion, string className, string resourceName) { - return String.Format(CultureInfo.InvariantCulture, "{0}\\{1}\\{2}\\{3}", moduleName, moduleVersion, className, resourceName); + return string.Format(CultureInfo.InvariantCulture, "{0}\\{1}\\{2}\\{3}", moduleName, moduleVersion, className, resourceName); } /// @@ -1085,7 +1087,7 @@ private static string GetModuleQualifiedResourceName(string moduleName, string m /// /// Module name. /// Resource type name. - /// Resource friendly name + /// Resource friendly name. /// List of found resources in the form of Dictionary{moduleQualifiedName, cimClass}, otherwise empty list. private static List> FindResourceInCache(string moduleName, string className, string resourceName) { @@ -1119,7 +1121,7 @@ private static List GetCachedClasses() var moduleQualifiedName = string.Format(CultureInfo.InvariantCulture, "{0}\\{1}", module.Name, module.Version.ToString()); foreach (var dscClassCacheEntry in ClassCache) { - if(dscClassCacheEntry.Key.StartsWith(moduleQualifiedName, StringComparison.OrdinalIgnoreCase)) + if (dscClassCacheEntry.Key.StartsWith(moduleQualifiedName, StringComparison.OrdinalIgnoreCase)) { cachedClasses.Add(dscClassCacheEntry.Value.CimClassInstance); } @@ -3154,6 +3156,7 @@ private static void ProcessMofForDynamicKeywords(PSModuleInfo module, ICollectio if (resourceList.Count > 0 && !string.IsNullOrEmpty(resourceList[0].Key)) { ClassCache.Remove(resourceList[0].Key); + // keyword is already defined and it is a Inbox resource, remove it if (DynamicKeyword.ContainsKeyword(friendlyName) && resourceList[0].Value.IsImportedImplicitly) { @@ -3283,9 +3286,9 @@ public static bool ImportCimKeywordsFromModule(PSModuleInfo module, string resou return false; } - + /// - /// Clear the 'IsImportedImplicitly' flag when explicitly importing a resource + /// Clear the 'IsImportedImplicitly' flag when explicitly importing a resource. /// /// ///