diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/AssemblyInfo.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/AssemblyInfo.cs index 25ea2930559..09297dcdc20 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/AssemblyInfo.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/AssemblyInfo.cs @@ -3,4 +3,4 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleTo("Microsoft.Windows.DSC.CoreConfProviders,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] +[assembly: InternalsVisibleTo("Microsoft.Windows.DSC.CoreConfProviders,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetAssociatedInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetAssociatedInstance.cs index ec8b3eaab4e..aee88fd57d6 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetAssociatedInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetAssociatedInstance.cs @@ -52,7 +52,7 @@ public void GetCimAssociatedInstance(GetCimAssociatedInstanceCommand cmdlet) foreach (string computerName in computerNames) { CimSessionProxy proxy = CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet); - proxys.Add(proxy); + proxys.Add(proxy); } break; diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs index 9178fd873ef..13fd5ffa66a 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs @@ -385,7 +385,7 @@ private void SetSessionProxyProperties( proxy.KeyOnly = getCimInstance.KeyOnly; proxy.Shallow = getCimInstance.Shallow; proxy.OperationTimeout = getCimInstance.OperationTimeoutSec; - if(getCimInstance.ResourceUri != null ) + if (getCimInstance.ResourceUri != null) { proxy.ResourceUri = getCimInstance.ResourceUri; } @@ -394,7 +394,7 @@ private void SetSessionProxyProperties( { RemoveCimInstanceCommand removeCimInstance = cmdlet as RemoveCimInstanceCommand; proxy.OperationTimeout = removeCimInstance.OperationTimeoutSec; - if(removeCimInstance.ResourceUri != null ) + if (removeCimInstance.ResourceUri != null) { proxy.ResourceUri = removeCimInstance.ResourceUri; } @@ -408,7 +408,7 @@ private void SetSessionProxyProperties( { SetCimInstanceCommand setCimInstance = cmdlet as SetCimInstanceCommand; proxy.OperationTimeout = setCimInstance.OperationTimeoutSec; - if(setCimInstance.ResourceUri != null ) + if (setCimInstance.ResourceUri != null) { proxy.ResourceUri = setCimInstance.ResourceUri; } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs index 16cefeac4bb..f77e8a04bba 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs @@ -288,7 +288,7 @@ public void Start() { DebugHelper.WriteLogEx(); - lock(myLock) + lock (myLock) { if (status == Status.Default) { diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs index 19dcbf378dd..bec0749dbd7 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs @@ -143,7 +143,7 @@ public void InvokeCimMethod(InvokeCimMethodCommand cmdlet) case CimBaseCommand.ResourceUriComputerSet: { string target = string.Format(CultureInfo.CurrentUICulture, targetClass, cmdlet.ClassName); - if(cmdlet.ResourceUri != null ) + if (cmdlet.ResourceUri != null) { nameSpace = cmdlet.Namespace; } @@ -210,7 +210,7 @@ public void InvokeCimMethod(InvokeCimMethodCommand cmdlet) case CimBaseCommand.CimInstanceSessionSet: { string target = cmdlet.CimInstance.ToString(); - if(cmdlet.ResourceUri != null ) + if (cmdlet.ResourceUri != null) { nameSpace = cmdlet.Namespace; } @@ -280,7 +280,7 @@ private void SetSessionProxyProperties( InvokeCimMethodCommand cmdlet) { proxy.OperationTimeout = cmdlet.OperationTimeoutSec; - if(cmdlet.ResourceUri != null ) + if (cmdlet.ResourceUri != null) { proxy.ResourceUri = cmdlet.ResourceUri; } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimNewCimInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimNewCimInstance.cs index 906fb4b3ff5..da3808459af 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimNewCimInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimNewCimInstance.cs @@ -211,7 +211,7 @@ private void SetSessionProxyProperties( NewCimInstanceCommand cmdlet) { proxy.OperationTimeout = cmdlet.OperationTimeoutSec; - if(cmdlet.ResourceUri != null) + if (cmdlet.ResourceUri != null) { proxy.ResourceUri = cmdlet.ResourceUri; } @@ -270,7 +270,7 @@ private CimInstance CreateCimInstance( IDictionary properties, NewCimInstanceCommand cmdlet) { - CimInstance cimInstance = new CimInstance(className,cimNamespace); + CimInstance cimInstance = new CimInstance(className, cimNamespace); if (properties == null) { return cimInstance; @@ -299,8 +299,8 @@ private CimInstance CreateCimInstance( DebugHelper.WriteLog("Create and add new property to ciminstance: name = {0}; value = {1}; flags = {2}", 5, propertyName, propertyValue, flag); - PSReference cimReference = propertyValue as PSReference; - if( cimReference != null ) + PSReference cimReference = propertyValue as PSReference; + if (cimReference != null) { CimProperty newProperty = CimProperty.Create(propertyName, GetBaseObject(cimReference.Value), CimType.Reference, flag); cimInstance.CimInstanceProperties.Add(newProperty); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRemoveCimInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRemoveCimInstance.cs index 1cff9b68eb7..3ed5511b802 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRemoveCimInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRemoveCimInstance.cs @@ -88,7 +88,7 @@ public void RemoveCimInstance(RemoveCimInstanceCommand cmdlet) case CimBaseCommand.CimInstanceComputerSet: case CimBaseCommand.CimInstanceSessionSet: string nameSpace = null; - if(cmdlet.ResourceUri != null ) + if (cmdlet.ResourceUri != null) { nameSpace = GetCimInstanceParameter(cmdlet).CimSystemProperties.Namespace; } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs index 19e1ca5792e..36c72ae697c 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs @@ -787,7 +787,7 @@ public CimSessionBase() { this.sessionState = cimSessions.GetOrAdd( CurrentRunspaceId, - delegate(Guid instanceId) + delegate (Guid instanceId) { if (Runspace.DefaultRunspace != null) { @@ -974,7 +974,7 @@ internal void NewCimSession(NewCimSessionCommand cmdlet, CimTestCimSessionContext context = new CimTestCimSessionContext(proxy, wrapper); proxy.ContextObject = context; // Skip test the connection if user intend to - if(cmdlet.SkipTestConnection.IsPresent) + if (cmdlet.SkipTestConnection.IsPresent) { AddSessionToCache(proxy.CimSession, context, new CmdletOperationBase(cmdlet)); } @@ -1171,7 +1171,7 @@ public void GetCimSession(GetCimSessionCommand cmdlet) if (sessionToGet != null) { - foreach(PSObject psobject in sessionToGet) + foreach (PSObject psobject in sessionToGet) { cmdlet.WriteObject(psobject); } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs index 1ba5c96220e..7e9bdb3d90e 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs @@ -419,7 +419,7 @@ public CimSessionProxy(string computerName, CimInstance cimInstance) string cimsessionComputerName = cimInstance.GetCimSessionComputerName(); CreateSetSession(cimsessionComputerName, null, null, null, false); - this.isDefaultSession = (cimsessionComputerName == ConstValue.NullComputerName); + this.isDefaultSession = (cimsessionComputerName == ConstValue.NullComputerName); DebugHelper.WriteLogEx("Create a temp session with computerName = {0}.", 0, cimsessionComputerName); } @@ -570,7 +570,7 @@ public Uri ResourceUri { DebugHelper.WriteLogEx("ResourceUri {0},", 0, value); - this.options.ResourceUri= value; + this.options.ResourceUri = value; } get @@ -606,7 +606,7 @@ public bool EnablePromptUser set { DebugHelper.WriteLogEx("EnablePromptUser {0}", 0, value); - if(value) + if (value) { this.options.PromptUser = this.PromptUser; } @@ -1876,10 +1876,10 @@ protected void ConsumeCimInvokeMethodResultAsync( CimResultContext cimResultContext) { CimMethodResultObserver observer = new CimMethodResultObserver(this.session, asyncResult, cimResultContext) - { - ClassName = className, - MethodName = methodName - }; + { + ClassName = className, + MethodName = methodName + }; observer.OnNewResult += this.ResultEventHandler; this.operationID = Interlocked.Increment(ref gOperationCounter); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs index eb651744fef..aa04d2d2aa7 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs @@ -243,7 +243,7 @@ private bool SetProperty(IDictionary properties, ref CimInstance cimInstance, re else // For dynamic instance, it is valid to add a new property { CimProperty newProperty; - if( value == null ) + if (value == null) { newProperty = CimProperty.Create( key, diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs index 8d8dadbf086..2c27fe777f5 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs @@ -49,7 +49,7 @@ internal static ErrorRecord ErrorRecordFromAnyException( if (containsErrorRecord != null) { return InitializeErrorRecord(context, - exception : inner, + exception: inner, errorId: "CimCmdlet_" + containsErrorRecord.ErrorRecord.FullyQualifiedErrorId, errorCategory: containsErrorRecord.ErrorRecord.CategoryInfo.Category, cimResultContext: cimResultContext); @@ -57,7 +57,7 @@ internal static ErrorRecord ErrorRecordFromAnyException( else { return InitializeErrorRecord(context, - exception :inner, + exception: inner, errorId: "CimCmdlet_" + inner.GetType().Name, errorCategory: ErrorCategory.NotSpecified, cimResultContext: cimResultContext); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimClassCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimClassCommand.cs index a12da58c356..b3571dbccc6 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimClassCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimClassCommand.cs @@ -94,7 +94,7 @@ public string Namespace [Parameter(ValueFromPipelineByPropertyName = true)] public UInt32 OperationTimeoutSec { - get { return operationTimeout;} + get { return operationTimeout; } set { operationTimeout = value; } } @@ -112,7 +112,7 @@ public UInt32 OperationTimeoutSec [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public CimSession[] CimSession { - get { return cimSession;} + get { return cimSession; } set { diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimSessionCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimSessionCommand.cs index f621f249e66..c648807d833 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimSessionCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimSessionCommand.cs @@ -58,7 +58,7 @@ public GetCimSessionCommand() [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public string[] ComputerName { - get { return computername;} + get { return computername; } set { @@ -80,7 +80,7 @@ public string[] ComputerName [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public UInt32[] Id { - get { return id;} + get { return id; } set { @@ -101,7 +101,7 @@ public UInt32[] Id [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public Guid[] InstanceId { - get { return instanceid;} + get { return instanceid; } set { @@ -123,7 +123,7 @@ public Guid[] InstanceId [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public string[] Name { - get { return name;} + get { return name; } set { diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs index 058ddcd3cbc..44daaabed95 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs @@ -306,10 +306,11 @@ public SwitchParameter ClientOnly { get { return clientOnly; } - set { + set + { clientOnly = value; base.SetParameter(value, nameClientOnly); - } + } } private SwitchParameter clientOnly; diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionCommand.cs index 39db6e2a018..ee83d12ff26 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionCommand.cs @@ -32,7 +32,7 @@ public sealed class NewCimSessionCommand : CimBaseCommand ParameterSetName = CredentialParameterSet)] public PasswordAuthenticationMechanism Authentication { - get { return authentication;} + get { return authentication; } set { @@ -88,7 +88,7 @@ public string CertificateThumbprint [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public string[] ComputerName { - get { return computername;} + get { return computername; } set { computername = value; } } @@ -109,7 +109,7 @@ public string[] ComputerName [Parameter(ValueFromPipelineByPropertyName = true)] public string Name { - get { return name;} + get { return name; } set { name = value; } } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimInstanceCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimInstanceCommand.cs index c542499906d..7c37b7c4610 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimInstanceCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimInstanceCommand.cs @@ -18,7 +18,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets [Cmdlet( VerbsCommon.Remove, "CimInstance", - SupportsShouldProcess=true, + SupportsShouldProcess = true, DefaultParameterSetName = CimBaseCommand.CimInstanceComputerSet, HelpUri = "https://go.microsoft.com/fwlink/?LinkId=227964")] public class RemoveCimInstanceCommand : CimBaseCommand @@ -143,7 +143,7 @@ public string Namespace [Parameter] public UInt32 OperationTimeoutSec { - get { return operationTimeout;} + get { return operationTimeout; } set { operationTimeout = value; } } @@ -201,7 +201,7 @@ internal CimInstance CimInstance ParameterSetName = CimBaseCommand.QuerySessionSet)] public string Query { - get { return query;} + get { return query; } set { @@ -223,7 +223,7 @@ public string Query ParameterSetName = CimBaseCommand.QueryComputerSet)] public string QueryDialect { - get { return querydialect;} + get { return querydialect; } set { diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimSessionCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimSessionCommand.cs index b8479588406..afbdf49343c 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimSessionCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimSessionCommand.cs @@ -54,7 +54,7 @@ public RemoveCimSessionCommand() [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public CimSession[] CimSession { - get { return cimsession;} + get { return cimsession; } set { @@ -104,7 +104,7 @@ public string[] ComputerName [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public UInt32[] Id { - get { return id;} + get { return id; } set { @@ -127,7 +127,7 @@ public UInt32[] Id [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public Guid[] InstanceId { - get { return instanceid;} + get { return instanceid; } set { @@ -150,7 +150,7 @@ public Guid[] InstanceId [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public string[] Name { - get { return name;} + get { return name; } set { diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs index b2c59c6afa6..7dc5281bcc7 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. // #define LOGENABLE // uncomment this line to enable the log, - // create c:\temp\cim.log before invoking cimcmdlets +// create c:\temp\cim.log before invoking cimcmdlets using System; using System.Collections.Generic; @@ -27,7 +27,7 @@ internal static class ConstValue /// Default computername /// /// - internal static string[] DefaultSessionName = {@"*"}; + internal static string[] DefaultSessionName = { @"*" }; /// /// @@ -364,7 +364,7 @@ private static void WriteLogInternal(string message, int indent, int depth) lock (logLock) { - using (FileStream fs = new FileStream(logFile,FileMode.OpenOrCreate)) + using (FileStream fs = new FileStream(logFile, FileMode.OpenOrCreate)) using (StreamWriter writer = new StreamWriter(fs)) { writer.WriteLineAsync(spaces[indent] + sourceInformation + @" " + message); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs index 3128c944703..79b36812065 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs @@ -74,7 +74,7 @@ private static bool CalculateIsTextTrimmed(TextBlock textBlock) textBlock.FontWeight, textBlock.FontStretch); - #pragma warning disable 612, 618 +#pragma warning disable 612, 618 // FormattedText is used to measure the whole width of the text held up by TextBlock container FormattedText formattedText = new FormattedText( textBlock.Text, @@ -83,7 +83,7 @@ private static bool CalculateIsTextTrimmed(TextBlock textBlock) typeface, textBlock.FontSize, textBlock.Foreground); - #pragma warning restore 612, 618 +#pragma warning restore 612, 618 return formattedText.Width > textBlock.ActualWidth; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ViewGroupToStringConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ViewGroupToStringConverter.cs index 24d737f2883..92c3a7a59db 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ViewGroupToStringConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ViewGroupToStringConverter.cs @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Text; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs index fde0c0eb68e..cff283bcf6a 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs @@ -37,7 +37,7 @@ public ShowModuleControl() /// public Window Owner { - get { return this.owner; } + get { return this.owner; } set { this.owner = value; } } diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs index c63bc4d2c02..c5e25028823 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs @@ -279,7 +279,7 @@ public Visibility NotImportedVisibility { get { - return this.IsImported ? Visibility.Collapsed : Visibility.Visible; + return this.IsImported ? Visibility.Collapsed : Visibility.Visible; } } diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs index 95925ff40de..882f9e21c54 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs @@ -1004,7 +1004,7 @@ private void ImportModuleDone(Dictionary imported { this.window.Dispatcher.Invoke( new SendOrPostCallback( - delegate(object ignored) + delegate (object ignored) { this.allModulesViewModel = ShowCommandHelper.GetNewAllModulesViewModel( this.allModulesViewModel, @@ -1054,7 +1054,7 @@ private void DisplayHelp(Collection getHelpResults) { this.window.Dispatcher.Invoke( new SendOrPostCallback( - delegate(object ignored) + delegate (object ignored) { HelpWindow help = new HelpWindow(getHelpResults[0]); help.Owner = this.window; diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs index 83aa93f02db..da136e9bf09 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs @@ -270,10 +270,11 @@ private struct PDH_TIME_INFO // We access those fields directly. The struct is here for reference only. // [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)] - struct PDH_COUNTER_INFO { - [FieldOffset(0)] public UInt32 dwLength; - [FieldOffset(4)] public UInt32 dwType; - [FieldOffset(8)] public UInt32 CVersion; + struct PDH_COUNTER_INFO + { + [FieldOffset(0)] public UInt32 dwLength; + [FieldOffset(4)] public UInt32 dwType; + [FieldOffset(8)] public UInt32 CVersion; [FieldOffset(12)] public UInt32 CStatus; [FieldOffset(16)] public UInt32 lScale; [FieldOffset(20)] public UInt32 lDefaultScale; @@ -289,7 +290,7 @@ struct PDH_COUNTER_INFO { [FieldOffset(88)] public string szCounterName; [FieldOffset(96)] public string szExplainText; - [FieldOffset(104)]public IntPtr DataBuffer; + [FieldOffset(104)] public IntPtr DataBuffer; } [DllImport("pdh.dll", CharSet = CharSet.Unicode)] diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs index 64d0c82a450..92302849359 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs @@ -1181,7 +1181,7 @@ public sealed class StopComputerCommand : PSCmdlet, IDisposable /// public void Dispose() { - _cancel.Dispose(); + _cancel.Dispose(); } #endregion "IDisposable Members" diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs index 0d0ad1256e0..eb2cca3242f 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs @@ -10,7 +10,7 @@ namespace Microsoft.PowerShell.Commands { - #region Stop-Computer +#region Stop-Computer /// /// Cmdlet to stop computer. @@ -19,15 +19,15 @@ namespace Microsoft.PowerShell.Commands HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2097151", RemotingCapability = RemotingCapability.SupportedByCommand)] public sealed class StopComputerCommand : PSCmdlet, IDisposable { - #region Private Members +#region Private Members private Process _process = null; - #endregion +#endregion // TODO: Support remote computers? - #region "IDisposable Members" +#region "IDisposable Members" /// /// Dispose Method. @@ -37,9 +37,9 @@ public void Dispose() _process.Dispose(); } - #endregion "IDisposable Members" +#endregion "IDisposable Members" - #region "Overrides" +#region "Overrides" /// /// BeginProcessing. @@ -68,9 +68,9 @@ protected override void StopProcessing() catch (NotSupportedException) {} } - #endregion "Overrides" +#endregion "Overrides" - #region "Internals" +#region "Internals" private void doShutdown() { String cmd = ""; @@ -96,8 +96,8 @@ private void doShutdown() { }; _process.Start(); } - #endregion +#endregion } - #endregion +#endregion } #endif diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs index 85257270a77..6f6855c6068 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs @@ -66,7 +66,7 @@ public sealed class GetHotFixCommand : PSCmdlet, IDisposable private ManagementObjectSearcher _searchProcess; private bool _inputContainsWildcard = false; - private readonly ConnectionOptions _connectionOptions = new ConnectionOptions { }; + private readonly ConnectionOptions _connectionOptions = new ConnectionOptions { }; /// /// Sets connection options. diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs index 0b2feeb2e53..72473902466 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs @@ -119,7 +119,7 @@ internal void SetServiceSecurityDescriptor( { var rawSecurityDescriptor = new RawSecurityDescriptor(securityDescriptorSddl); RawAcl rawDiscretionaryAcl = rawSecurityDescriptor.DiscretionaryAcl; - var discretionaryAcl = new DiscretionaryAcl (false, false, rawDiscretionaryAcl); + var discretionaryAcl = new DiscretionaryAcl(false, false, rawDiscretionaryAcl); byte[] rawDacl = new byte[discretionaryAcl.BinaryLength]; discretionaryAcl.GetBinaryForm(rawDacl, 0); @@ -1920,7 +1920,7 @@ protected override void ProcessRecord() } } - if(!string.IsNullOrEmpty(SecurityDescriptorSddl)) + if (!string.IsNullOrEmpty(SecurityDescriptorSddl)) { SetServiceSecurityDescriptor(service, SecurityDescriptorSddl, hService); } @@ -2640,7 +2640,7 @@ internal static class NativeMethods internal const DWORD SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3; internal const DWORD SERVICE_CONFIG_SERVICE_SID_INFO = 5; internal const DWORD WRITE_DAC = 262144; - internal const DWORD WRITE_OWNER =524288; + internal const DWORD WRITE_OWNER = 524288; internal const DWORD SERVICE_WIN32_OWN_PROCESS = 0x10; internal const DWORD SERVICE_ERROR_NORMAL = 1; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs index ff468ba422e..43db8154484 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs @@ -1089,26 +1089,26 @@ public string Culture { case StringComparison.Ordinal: case StringComparison.OrdinalIgnoreCase: - { - return OrdinalCultureName; - } + { + return OrdinalCultureName; + } case StringComparison.InvariantCulture: case StringComparison.InvariantCultureIgnoreCase: - { - return InvariantCultureName; - } + { + return InvariantCultureName; + } case StringComparison.CurrentCulture: case StringComparison.CurrentCultureIgnoreCase: - { - return CurrentCultureName; - } + { + return CurrentCultureName; + } default: - { - break; - } + { + break; + } } return _cultureName; @@ -1126,8 +1126,8 @@ public string Culture internal const string CurrentCultureName = "Current"; private string _cultureName = CultureInfo.CurrentCulture.Name; - private StringComparison _stringComparison = StringComparison.CurrentCultureIgnoreCase; - private CompareOptions _compareOptions = CompareOptions.IgnoreCase; + private StringComparison _stringComparison = StringComparison.CurrentCultureIgnoreCase; + private CompareOptions _compareOptions = CompareOptions.IgnoreCase; private delegate int CultureInfoIndexOf(string source, string value, int startIndex, int count, CompareOptions options); @@ -1140,36 +1140,36 @@ private void InitCulture() switch (_cultureName) { case OrdinalCultureName: - { - _stringComparison = CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; - _compareOptions = CaseSensitive ? CompareOptions.Ordinal : CompareOptions.OrdinalIgnoreCase; - _cultureInfoIndexOf = CultureInfo.InvariantCulture.CompareInfo.IndexOf; - break; - } + { + _stringComparison = CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; + _compareOptions = CaseSensitive ? CompareOptions.Ordinal : CompareOptions.OrdinalIgnoreCase; + _cultureInfoIndexOf = CultureInfo.InvariantCulture.CompareInfo.IndexOf; + break; + } case InvariantCultureName: - { - _stringComparison = CaseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase; - _compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase; - _cultureInfoIndexOf = CultureInfo.InvariantCulture.CompareInfo.IndexOf; - break; - } + { + _stringComparison = CaseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase; + _compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase; + _cultureInfoIndexOf = CultureInfo.InvariantCulture.CompareInfo.IndexOf; + break; + } case CurrentCultureName: - { - _stringComparison = CaseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase; - _compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase; - _cultureInfoIndexOf = CultureInfo.CurrentCulture.CompareInfo.IndexOf; - break; - } + { + _stringComparison = CaseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase; + _compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase; + _cultureInfoIndexOf = CultureInfo.CurrentCulture.CompareInfo.IndexOf; + break; + } default: - { - var _cultureInfo = CultureInfo.GetCultureInfo(_cultureName); - _compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase; - _cultureInfoIndexOf = _cultureInfo.CompareInfo.IndexOf; - break; - } + { + var _cultureInfo = CultureInfo.GetCultureInfo(_cultureName); + _compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase; + _cultureInfoIndexOf = _cultureInfo.CompareInfo.IndexOf; + break; + } } } diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 30e9c2b1f38..108574d9f00 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -595,49 +595,49 @@ public enum ItemType public enum StatMask { /// The mask to collect the owner mode. - OwnerModeMask = 0x1C0, + OwnerModeMask = 0x1C0, /// The mask to get the owners read bit. - OwnerRead = 0x100, - + OwnerRead = 0x100, + /// The mask to get the owners write bit. - OwnerWrite = 0x080, - + OwnerWrite = 0x080, + /// The mask to get the owners execute bit. - OwnerExecute = 0x040, - + OwnerExecute = 0x040, + /// The mask to get the group mode. - GroupModeMask = 0x038, - + GroupModeMask = 0x038, + /// The mask to get the group mode. - GroupRead = 0x20, - + GroupRead = 0x20, + /// The mask to get the group mode. - GroupWrite = 0x10, - + GroupWrite = 0x10, + /// The mask to get the group mode. - GroupExecute = 0x8, - + GroupExecute = 0x8, + /// The mask to get the "other" mode. - OtherModeMask = 0x007, - + OtherModeMask = 0x007, + /// The mask to get the "other" read bit. - OtherRead = 0x004, - + OtherRead = 0x004, + /// The mask to get the "other" write bit. - OtherWrite = 0x002, - + OtherWrite = 0x002, + /// The mask to get the "other" execute bit. - OtherExecute = 0x001, + OtherExecute = 0x001, /// The mask to retrieve the sticky bit. - SetStickyMask = 0x200, - + SetStickyMask = 0x200, + /// The mask to retrieve the setgid bit. - SetGidMask = 0x400, + SetGidMask = 0x400, /// The mask to retrieve the setuid bit. - SetUidMask = 0x800, + SetUidMask = 0x800, } /// The Common Stat class. @@ -772,7 +772,7 @@ public string GetModeString() return new string(modeCharacters); } - + /// /// Get the user name. This is used in formatting, but we shouldn't /// do the pinvoke this unless we're going to use it. @@ -792,7 +792,7 @@ public string GetUserName() return username; } - + /// /// Get the group name. This is used in formatting, but we shouldn't /// do the pinvoke this unless we're going to use it. @@ -857,81 +857,81 @@ public static bool IsHardLink(FileSystemInfo fs) /// A managed common stat class instance. private static CommonStat CopyStatStruct(NativeMethods.CommonStatStruct css) { - CommonStat cs = new CommonStat(); - cs.Inode = css.Inode; - cs.Mode = css.Mode; - cs.UserId = css.UserId; - cs.GroupId = css.GroupId; - cs.HardlinkCount = css.HardlinkCount; - cs.Size = css.Size; - - // These can sometime throw if we get too large a number back (seen on Raspbian). - // As a fallback, set the time to UnixEpoch. - try - { - cs.AccessTime = DateTime.UnixEpoch.AddSeconds(css.AccessTime).ToLocalTime(); - } - catch - { - cs.AccessTime = DateTime.UnixEpoch.ToLocalTime(); - } + CommonStat cs = new CommonStat(); + cs.Inode = css.Inode; + cs.Mode = css.Mode; + cs.UserId = css.UserId; + cs.GroupId = css.GroupId; + cs.HardlinkCount = css.HardlinkCount; + cs.Size = css.Size; + + // These can sometime throw if we get too large a number back (seen on Raspbian). + // As a fallback, set the time to UnixEpoch. + try + { + cs.AccessTime = DateTime.UnixEpoch.AddSeconds(css.AccessTime).ToLocalTime(); + } + catch + { + cs.AccessTime = DateTime.UnixEpoch.ToLocalTime(); + } - try - { - cs.ModifiedTime = DateTime.UnixEpoch.AddSeconds(css.ModifiedTime).ToLocalTime(); - } - catch - { - cs.ModifiedTime = DateTime.UnixEpoch.ToLocalTime(); - } + try + { + cs.ModifiedTime = DateTime.UnixEpoch.AddSeconds(css.ModifiedTime).ToLocalTime(); + } + catch + { + cs.ModifiedTime = DateTime.UnixEpoch.ToLocalTime(); + } - try - { - cs.StatusChangeTime = DateTime.UnixEpoch.AddSeconds(css.StatusChangeTime).ToLocalTime(); - } - catch - { - cs.StatusChangeTime = DateTime.UnixEpoch.ToLocalTime(); - } + try + { + cs.StatusChangeTime = DateTime.UnixEpoch.AddSeconds(css.StatusChangeTime).ToLocalTime(); + } + catch + { + cs.StatusChangeTime = DateTime.UnixEpoch.ToLocalTime(); + } - cs.BlockSize = css.BlockSize; - cs.DeviceId = css.DeviceId; - cs.NumberOfBlocks = css.NumberOfBlocks; + cs.BlockSize = css.BlockSize; + cs.DeviceId = css.DeviceId; + cs.NumberOfBlocks = css.NumberOfBlocks; - if (css.IsDirectory == 1) - { - cs.ItemType = ItemType.Directory; - } - else if (css.IsFile == 1) - { - cs.ItemType = ItemType.File; - } - else if (css.IsSymbolicLink == 1) - { - cs.ItemType = ItemType.SymbolicLink; - } - else if (css.IsBlockDevice == 1) - { - cs.ItemType = ItemType.BlockDevice; - } - else if (css.IsCharacterDevice == 1) - { - cs.ItemType = ItemType.CharacterDevice; - } - else if (css.IsNamedPipe == 1) - { - cs.ItemType = ItemType.NamedPipe; - } - else - { - cs.ItemType = ItemType.Socket; - } + if (css.IsDirectory == 1) + { + cs.ItemType = ItemType.Directory; + } + else if (css.IsFile == 1) + { + cs.ItemType = ItemType.File; + } + else if (css.IsSymbolicLink == 1) + { + cs.ItemType = ItemType.SymbolicLink; + } + else if (css.IsBlockDevice == 1) + { + cs.ItemType = ItemType.BlockDevice; + } + else if (css.IsCharacterDevice == 1) + { + cs.ItemType = ItemType.CharacterDevice; + } + else if (css.IsNamedPipe == 1) + { + cs.ItemType = ItemType.NamedPipe; + } + else + { + cs.ItemType = ItemType.Socket; + } - cs.IsSetUid = css.IsSetUid == 1; - cs.IsSetGid = css.IsSetGid == 1; - cs.IsSticky = css.IsSticky == 1; + cs.IsSetUid = css.IsSetUid == 1; + cs.IsSetGid = css.IsSetGid == 1; + cs.IsSticky = css.IsSticky == 1; - return cs; + return cs; } /// Get the lstat info from a path. @@ -1140,7 +1140,7 @@ internal struct CommonStatStruct /// This filesystem item is a file. internal int IsFile; - + /// This filesystem item is a symbolic link. internal int IsSymbolicLink; diff --git a/src/System.Management.Automation/engine/CommandSearcher.cs b/src/System.Management.Automation/engine/CommandSearcher.cs index 282976fadf8..4967024aef4 100644 --- a/src/System.Management.Automation/engine/CommandSearcher.cs +++ b/src/System.Management.Automation/engine/CommandSearcher.cs @@ -1549,7 +1549,7 @@ private void setupPathSearcher() _context.CommandDiscovery.GetLookupDirectoryPaths(), _context, ConstructSearchPatternsFromName(_commandName, commandDiscovery: true), - useFuzzyMatch : false); + useFuzzyMatch: false); } else if (_canDoPathLookupResult == CanDoPathLookupResult.PathIsRooted) { @@ -1573,7 +1573,7 @@ private void setupPathSearcher() directoryCollection, _context, ConstructSearchPatternsFromName(fileName, commandDiscovery: true), - useFuzzyMatch : false); + useFuzzyMatch: false); } else { @@ -1613,7 +1613,7 @@ private void setupPathSearcher() directoryCollection, _context, ConstructSearchPatternsFromName(fileName, commandDiscovery: true), - useFuzzyMatch : false); + useFuzzyMatch: false); } else { diff --git a/src/System.Management.Automation/engine/CoreAdapter.cs b/src/System.Management.Automation/engine/CoreAdapter.cs index bd5c6a53503..438af05dbac 100644 --- a/src/System.Management.Automation/engine/CoreAdapter.cs +++ b/src/System.Management.Automation/engine/CoreAdapter.cs @@ -3784,7 +3784,8 @@ internal void AddAllProperties(object obj, PSMemberInfoInternalCollection name: propertyEntry.member.Name, adapter: this, baseObject: obj, - adapterData: propertyEntry) { IsHidden = propertyEntry.IsHidden } as T); + adapterData: propertyEntry) + { IsHidden = propertyEntry.IsHidden } as T); } } } diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index 2b419bddba3..f042af3bc0a 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -3584,7 +3584,7 @@ internal void UpdateTypes(ExecutionContext context, bool updateOnly) ConcurrentBag errors = new ConcurrentBag(); // Use at most 3 locks (we don't expect contention on that many cores anyways, // and typically we'll be processing just 2 or 3 files anyway, hence capacity=3. - ConcurrentDictionary filesProcessed = new ConcurrentDictionary( + ConcurrentDictionary filesProcessed = new ConcurrentDictionary( concurrencyLevel: 3, capacity: 3, StringComparer.OrdinalIgnoreCase); diff --git a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs index c55bbfba132..abc73681745 100644 --- a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs +++ b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs @@ -1896,7 +1896,7 @@ internal override IList ImportModulesUsingWinCompat(IEnumerable moduleProxies = ImportModulesUsingWinCompat(new string [] {moduleManifestPath}, null, new ImportModuleOptions()); + IList moduleProxies = ImportModulesUsingWinCompat(new string[] { moduleManifestPath }, null, new ImportModuleOptions()); // we are loading by a single ManifestPath so expect max of 1 - if(moduleProxies.Count > 0) + if (moduleProxies.Count > 0) { return moduleProxies[0]; } @@ -4810,7 +4810,7 @@ internal PSSession GetWindowsPowerShellCompatRemotingSession() internal PSSession CreateWindowsPowerShellCompatResources() { PSSession compatSession = null; - lock(s_WindowsPowerShellCompatSyncObject) + lock (s_WindowsPowerShellCompatSyncObject) { compatSession = GetWindowsPowerShellCompatRemotingSession(); if (compatSession == null) @@ -4834,7 +4834,7 @@ internal PSSession CreateWindowsPowerShellCompatResources() internal void CleanupWindowsPowerShellCompatResources() { - lock(s_WindowsPowerShellCompatSyncObject) + lock (s_WindowsPowerShellCompatSyncObject) { var compatSession = GetWindowsPowerShellCompatRemotingSession(); if (compatSession != null) @@ -4848,7 +4848,7 @@ internal void CleanupWindowsPowerShellCompatResources() } } - internal virtual IList ImportModulesUsingWinCompat(IEnumerable moduleNames, IEnumerable moduleFullyQualifiedNames, ImportModuleOptions importModuleOptions) {throw new System.NotImplementedException();} + internal virtual IList ImportModulesUsingWinCompat(IEnumerable moduleNames, IEnumerable moduleFullyQualifiedNames, ImportModuleOptions importModuleOptions) { throw new System.NotImplementedException(); } private void RemoveTypesAndFormatting( IList formatFilesToRemove, diff --git a/src/System.Management.Automation/engine/TypeTable_TypesV3_Ps1Xml.cs b/src/System.Management.Automation/engine/TypeTable_TypesV3_Ps1Xml.cs index a2038b8a4eb..f95d3e04035 100644 --- a/src/System.Management.Automation/engine/TypeTable_TypesV3_Ps1Xml.cs +++ b/src/System.Management.Automation/engine/TypeTable_TypesV3_Ps1Xml.cs @@ -365,7 +365,8 @@ private void Process_TypesV3_Ps1Xml(string filePath, ConcurrentBag error new PSCodeProperty( @"SerializedInvocationInfo", GetMethodInfo(typeof(Microsoft.PowerShell.DeserializingTypeConverter), @"GetInvocationInfo"), - setterCodeReference: null) { IsHidden = true }, + setterCodeReference: null) + { IsHidden = true }, typeMembers, isOverride: false); diff --git a/src/System.Management.Automation/engine/TypeTable_Types_Ps1Xml.cs b/src/System.Management.Automation/engine/TypeTable_Types_Ps1Xml.cs index caec473485e..15e940d4302 100644 --- a/src/System.Management.Automation/engine/TypeTable_Types_Ps1Xml.cs +++ b/src/System.Management.Automation/engine/TypeTable_Types_Ps1Xml.cs @@ -705,7 +705,8 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag errors) new PSCodeProperty( @"NameString", GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"NameString"), - setterCodeReference: null) { IsHidden = true }, + setterCodeReference: null) + { IsHidden = true }, typeMembers, isOverride: false); @@ -716,7 +717,8 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag errors) new PSCodeProperty( @"LengthString", GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"LengthString"), - setterCodeReference: null) { IsHidden = true }, + setterCodeReference: null) + { IsHidden = true }, typeMembers, isOverride: false); @@ -727,7 +729,8 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag errors) new PSCodeProperty( @"LastWriteTimeString", GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"LastWriteTimeString"), - setterCodeReference: null) { IsHidden = true }, + setterCodeReference: null) + { IsHidden = true }, typeMembers, isOverride: false); @@ -830,7 +833,8 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag errors) new PSCodeProperty( @"NameString", GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"NameString"), - setterCodeReference: null) { IsHidden = true }, + setterCodeReference: null) + { IsHidden = true }, typeMembers, isOverride: false); @@ -841,7 +845,8 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag errors) new PSCodeProperty( @"LengthString", GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"LengthString"), - setterCodeReference: null) { IsHidden = true }, + setterCodeReference: null) + { IsHidden = true }, typeMembers, isOverride: false); @@ -852,7 +857,8 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag errors) new PSCodeProperty( @"LastWriteTimeString", GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"LastWriteTimeString"), - setterCodeReference: null) { IsHidden = true }, + setterCodeReference: null) + { IsHidden = true }, typeMembers, isOverride: false); @@ -5095,7 +5101,8 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag errors) new PSCodeProperty( @"Flags", GetMethodInfo(typeof(Microsoft.PowerShell.DeserializingTypeConverter), @"GetParameterSetMetadataFlags"), - setterCodeReference: null) { IsHidden = true }, + setterCodeReference: null) + { IsHidden = true }, typeMembers, isOverride: false); @@ -5256,7 +5263,8 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag errors) new PSCodeProperty( @"InstanceId", GetMethodInfo(typeof(Microsoft.PowerShell.DeserializingTypeConverter), @"GetFormatViewDefinitionInstanceId"), - setterCodeReference: null) { IsHidden = true }, + setterCodeReference: null) + { IsHidden = true }, typeMembers, isOverride: false); diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index 19a9c5e0995..3b183bb2125 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -645,7 +645,7 @@ public void SetBreakpoints(IEnumerable breakpoints) => /// /// Breakpoints. /// The runspace id of the runspace you want to interact with, null being the current runspace. - public virtual void SetBreakpoints(IEnumerable breakpoints, int? runspaceId) => + public virtual void SetBreakpoints(IEnumerable breakpoints, int? runspaceId) => throw new PSNotImplementedException(); /// @@ -3947,7 +3947,7 @@ private void ProcessRunspaceDebugInternally(Runspace runspace) { WaitForReadyDebug(); - DebugRunspace(runspace, breakAll:true); + DebugRunspace(runspace, breakAll: true); // Block this event thread until debugging has ended. WaitForDebugComplete(); diff --git a/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs b/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs index 7a04c40cf70..43b27614a12 100644 --- a/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs +++ b/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs @@ -971,7 +971,7 @@ internal bool CanRunActionInCurrentPipeline() // If we have no running pipeline, or if the currently running pipeline is // the same as the current thread, then execute the action. var pipelineRunning = _currentlyRunningPipeline as PipelineBase; - return pipelineRunning == null || + return pipelineRunning == null || Thread.CurrentThread == pipelineRunning.NestedPipelineExecutionThread; } } diff --git a/src/System.Management.Automation/engine/lang/parserutils.cs b/src/System.Management.Automation/engine/lang/parserutils.cs index 4d227ad7c95..38045a18d9c 100644 --- a/src/System.Management.Automation/engine/lang/parserutils.cs +++ b/src/System.Management.Automation/engine/lang/parserutils.cs @@ -600,7 +600,8 @@ private static IReadOnlyList NegativeSplitWithPredicate(ExecutionContext int subStringLength = 0; - for (int charCount = 0; charCount < item.Length; charCount++) { + for (int charCount = 0; charCount < item.Length; charCount++) + { // Evaluate the predicate using the character at cursor. object predicateResult = predicate.DoInvokeReturnAsIs( useLocalScope: true, diff --git a/src/System.Management.Automation/engine/parser/Compiler.cs b/src/System.Management.Automation/engine/parser/Compiler.cs index 6b64b2260bd..1a0c8e104d3 100644 --- a/src/System.Management.Automation/engine/parser/Compiler.cs +++ b/src/System.Management.Automation/engine/parser/Compiler.cs @@ -962,7 +962,7 @@ internal Expression ReduceAssignment(ISupportsAssignment left, TokenKind tokenKi var temps = new List(); var getExpr = av.GetValue(this, exprs, temps); - if(et == ExpressionType.Coalesce) + if (et == ExpressionType.Coalesce) { exprs.Add(av.SetValue(this, Coalesce(getExpr, right))); } @@ -982,7 +982,7 @@ private static Expression Coalesce(Expression left, Expression right) { return left; } - else if(leftType == typeof(AutomationNull)) + else if (leftType == typeof(AutomationNull)) { return right; } @@ -3307,7 +3307,7 @@ private bool ShouldSetExecutionStatusToSuccess(ExpressionAst expressionAst) // e.g. ("Hi"), vs (Test-Path ./here.txt) return ShouldSetExecutionStatusToSuccess(parenExpression.Pipeline); - case SubExpressionAst subExpressionAst: + case SubExpressionAst subExpressionAst: // Subexpressions generally set $? since they encapsulate a statement block // But $() requires an explicit setting return subExpressionAst.SubExpression.Statements.Count == 0; diff --git a/src/System.Management.Automation/engine/parser/tokenizer.cs b/src/System.Management.Automation/engine/parser/tokenizer.cs index 52b28d8529a..e11d7f8de7d 100644 --- a/src/System.Management.Automation/engine/parser/tokenizer.cs +++ b/src/System.Management.Automation/engine/parser/tokenizer.cs @@ -885,9 +885,9 @@ internal static bool IsKeyword(string str) internal void SkipNewlines(bool skipSemis) { - // We normally don't create any tokens in a Skip method, but the - // V2 tokenizer api returns newline, semi-colon, and line - // continuation tokens so we create them as they are encountered. + // We normally don't create any tokens in a Skip method, but the + // V2 tokenizer api returns newline, semi-colon, and line + // continuation tokens so we create them as they are encountered. again: char c = GetChar(); switch (c) diff --git a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs index 462cc19f926..76e257373d4 100644 --- a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs +++ b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs @@ -2105,7 +2105,7 @@ public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlo { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.SetBreakpoint); - + Breakpoint breakpoint = new CommandBreakpoint(path, null, command, action); var functionParameters = new Dictionary { diff --git a/src/System.Management.Automation/engine/remoting/client/remoterunspaceinfo.cs b/src/System.Management.Automation/engine/remoting/client/remoterunspaceinfo.cs index 949cce46dc6..b598d3ecbc9 100644 --- a/src/System.Management.Automation/engine/remoting/client/remoterunspaceinfo.cs +++ b/src/System.Management.Automation/engine/remoting/client/remoterunspaceinfo.cs @@ -322,7 +322,7 @@ private string GetTransportName() case WSManConnectionInfo _: return "WSMan"; - case SSHConnectionInfo _: + case SSHConnectionInfo _: return "SSH"; case NamedPipeConnectionInfo _: diff --git a/src/System.Management.Automation/engine/remoting/commands/StartJob.cs b/src/System.Management.Automation/engine/remoting/commands/StartJob.cs index 8e1ba2ce8c7..89a96b938af 100644 --- a/src/System.Management.Automation/engine/remoting/commands/StartJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/StartJob.cs @@ -598,14 +598,14 @@ protected override void BeginProcessing() if (WorkingDirectory != null && !Directory.Exists(WorkingDirectory)) { - string message = StringUtil.Format(RemotingErrorIdStrings.StartJobWorkingDirectoryNotFound, WorkingDirectory); - var errorRecord = new ErrorRecord( - new DirectoryNotFoundException(message), - "DirectoryNotFoundException", - ErrorCategory.InvalidOperation, - targetObject: null); - - ThrowTerminatingError(errorRecord); + string message = StringUtil.Format(RemotingErrorIdStrings.StartJobWorkingDirectoryNotFound, WorkingDirectory); + var errorRecord = new ErrorRecord( + new DirectoryNotFoundException(message), + "DirectoryNotFoundException", + ErrorCategory.InvalidOperation, + targetObject: null); + + ThrowTerminatingError(errorRecord); } if (WorkingDirectory == null) diff --git a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteDebuggingCapability.cs b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteDebuggingCapability.cs index c093e092636..b4d5072e046 100644 --- a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteDebuggingCapability.cs +++ b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteDebuggingCapability.cs @@ -93,20 +93,20 @@ internal static class RemoteDebuggingCommands #region DO NOT REMOVE OR CHANGE THE VALUES OF THESE CONSTANTS - it will break remote debugging compatibility with PowerShell // Commands related to debugger stop events - internal const string GetDebuggerStopArgs = "__Get-PSDebuggerStopArgs"; - internal const string SetDebuggerAction = "__Set-PSDebuggerAction"; + internal const string GetDebuggerStopArgs = "__Get-PSDebuggerStopArgs"; + internal const string SetDebuggerAction = "__Set-PSDebuggerAction"; // Miscellaneous debug commands - internal const string SetDebuggerStepMode = "__Set-PSDebuggerStepMode"; - internal const string SetDebugMode = "__Set-PSDebugMode"; + internal const string SetDebuggerStepMode = "__Set-PSDebuggerStepMode"; + internal const string SetDebugMode = "__Set-PSDebugMode"; internal const string SetUnhandledBreakpointMode = "__Set-PSUnhandledBreakpointMode"; // Breakpoint commands - internal const string GetBreakpoint = "__Get-PSBreakpoint"; - internal const string SetBreakpoint = "__Set-PSBreakpoint"; - internal const string EnableBreakpoint = "__Enable-PSBreakpoint"; - internal const string DisableBreakpoint = "__Disable-PSBreakpoint"; - internal const string RemoveBreakpoint = "__Remove-PSBreakpoint"; + internal const string GetBreakpoint = "__Get-PSBreakpoint"; + internal const string SetBreakpoint = "__Set-PSBreakpoint"; + internal const string EnableBreakpoint = "__Enable-PSBreakpoint"; + internal const string DisableBreakpoint = "__Disable-PSBreakpoint"; + internal const string RemoveBreakpoint = "__Remove-PSBreakpoint"; #endregion diff --git a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs index 4d17db06453..f1b6e9ea51c 100644 --- a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs +++ b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs @@ -791,7 +791,7 @@ private void HandleCreateAndInvokePowerShell(object _, RemoteDataEventArgs(command, "RunspaceId", out int? runspaceId); if (TryGetParameter(command, "Id", out int breakpointId)) { - preProcessOutput.Add(serverRemoteDebugger.GetBreakpoint(breakpointId, runspaceId)); + preProcessOutput.Add(serverRemoteDebugger.GetBreakpoint(breakpointId, runspaceId)); } else { @@ -1477,7 +1477,7 @@ private static PreProcessCommandResult PreProcessDebuggerCommand( } serverRemoteDebugger.SetBreakpoints(bps, runspaceId); - + foreach (var bp in bps) { preProcessOutput.Add(bp); @@ -1497,7 +1497,7 @@ private static PreProcessCommandResult PreProcessDebuggerCommand( Breakpoint breakpoint = serverRemoteDebugger.GetBreakpoint(breakpointId, runspaceId); preProcessOutput.Add( - breakpoint == null + breakpoint == null ? false : serverRemoteDebugger.RemoveBreakpoint(breakpoint, runspaceId)); @@ -1518,7 +1518,7 @@ private static PreProcessCommandResult PreProcessDebuggerCommand( { preProcessOutput.Add(serverRemoteDebugger.EnableBreakpoint(bp, runspaceId)); } - + result = PreProcessCommandResult.BreakpointManagement; } else if (commandText.Equals(RemoteDebuggingCommands.DisableBreakpoint, StringComparison.OrdinalIgnoreCase)) @@ -1536,7 +1536,7 @@ private static PreProcessCommandResult PreProcessDebuggerCommand( { preProcessOutput.Add(serverRemoteDebugger.DisableBreakpoint(bp, runspaceId)); } - + result = PreProcessCommandResult.BreakpointManagement; } @@ -1578,7 +1578,7 @@ private static bool TryGetParameter(Command command, string parameterName, ou value = GetParameter(command, parameterName); return true; } - catch (Exception ex) when( + catch (Exception ex) when ( ex is PSArgumentException || ex is InvalidCastException || ex is PSInvalidCastException) diff --git a/src/System.Management.Automation/utils/Telemetry.cs b/src/System.Management.Automation/utils/Telemetry.cs index fd947226392..bf4f0be1f55 100644 --- a/src/System.Management.Automation/utils/Telemetry.cs +++ b/src/System.Management.Automation/utils/Telemetry.cs @@ -28,7 +28,7 @@ internal enum TelemetryType /// will be reported, otherwise it will be "anonymous". /// ModuleLoad, - + /// /// Send telemetry when we load a module using Windows compatibility feature, only module names in the s_knownModules list /// will be reported, otherwise it will be "anonymous". @@ -121,21 +121,21 @@ static ApplicationInsightsTelemetry() s_knownModules = new HashSet(StringComparer.OrdinalIgnoreCase) { "AADRM", - "activedirectory", + "activedirectory", "adcsadministration", - "adcsdeployment", + "adcsdeployment", "addsadministration", - "addsdeployment", + "addsdeployment", "adfs", "adrms", - "adrmsadmin", + "adrmsadmin", "agpm", - "appbackgroundtask", + "appbackgroundtask", "applocker", "appv", - "appvclient", - "appvsequencer", - "appvserver", + "appvclient", + "appvsequencer", + "appvserver", "appx", "assignedaccess", "Az", diff --git a/test/xUnit/csharp/test_FileSystemProvider.cs b/test/xUnit/csharp/test_FileSystemProvider.cs index f6dc81ddda0..f3f690ebeca 100644 --- a/test/xUnit/csharp/test_FileSystemProvider.cs +++ b/test/xUnit/csharp/test_FileSystemProvider.cs @@ -124,7 +124,7 @@ public void TestGetProperty() PSObject pso = new PSObject(); pso.AddOrSetProperty("IsReadOnly", false); fileSystemProvider.SetProperty(testPath, pso); - fileSystemProvider.GetProperty(testPath, new Collection(){ "IsReadOnly" }); + fileSystemProvider.GetProperty(testPath, new Collection() { "IsReadOnly" }); FileInfo fileSystemObject1 = new FileInfo(testPath); PSObject psobject1 = PSObject.AsPSObject(fileSystemObject1); PSPropertyInfo property = psobject1.Properties["IsReadOnly"]; @@ -138,7 +138,7 @@ public void TestSetProperty() ProviderInfo providerInfoToSet = GetProvider(); fileSystemProvider.SetProviderInformation(providerInfoToSet); fileSystemProvider.Context = new CmdletProviderContext(GetExecutionContext()); - fileSystemProvider.GetProperty(testPath, new Collection(){ "Name" }); + fileSystemProvider.GetProperty(testPath, new Collection() { "Name" }); FileInfo fileSystemObject1 = new FileInfo(testPath); PSObject psobject1 = PSObject.AsPSObject(fileSystemObject1); PSPropertyInfo property = psobject1.Properties["FullName"]; @@ -153,7 +153,7 @@ public void TestClearProperty() ProviderInfo providerInfoToSet = GetProvider(); fileSystemProvider.SetProviderInformation(providerInfoToSet); fileSystemProvider.Context = new CmdletProviderContext(GetExecutionContext()); - fileSystemProvider.ClearProperty(testPath, new Collection(){ "Attributes" }); + fileSystemProvider.ClearProperty(testPath, new Collection() { "Attributes" }); } [Fact] @@ -178,7 +178,7 @@ public void TestGetContentWriter() fileSystemProvider.Context = new CmdletProviderContext(GetExecutionContext()); IContentWriter contentWriter = fileSystemProvider.GetContentWriter(testPath); - contentWriter.Write(new List(){ "contentWriterTestContent" }); + contentWriter.Write(new List() { "contentWriterTestContent" }); contentWriter.Close(); Assert.Equal(File.ReadAllText(testPath), testContent + @"contentWriterTestContent" + System.Environment.NewLine); } diff --git a/test/xUnit/csharp/test_NamedPipe.cs b/test/xUnit/csharp/test_NamedPipe.cs index 6bf55b813e8..eac61c4d1bf 100644 --- a/test/xUnit/csharp/test_NamedPipe.cs +++ b/test/xUnit/csharp/test_NamedPipe.cs @@ -10,7 +10,7 @@ namespace PSTests.Parallel { public class NamedPipeTests - { + { [Fact] public void TestCustomPipeNameCreation() { @@ -35,7 +35,7 @@ public void TestCustomPipeNameCreationTooLongOnNonWindows() if (!Platform.IsWindows) { - Assert.Throws(() => + Assert.Throws(() => RemoteSessionNamedPipeServer.CreateCustomNamedPipeServer(longPipeName)); } else