diff --git a/src/System.Management.Automation/engine/ComInterop/ComEventSinksContainer.cs b/src/System.Management.Automation/engine/ComInterop/ComEventSinksContainer.cs index d76d1c8edb4..52a11e7f041 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComEventSinksContainer.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComEventSinksContainer.cs @@ -24,7 +24,7 @@ private ComEventSinksContainer() public static ComEventSinksContainer FromRuntimeCallableWrapper(object rcw, bool createIfNotFound) { object data = Marshal.GetComObjectData(rcw, s_comObjectEventSinksKey); - if (data != null || createIfNotFound == false) + if (data != null || !createIfNotFound) { return (ComEventSinksContainer)data; } diff --git a/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs b/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs index bf4c3f021f0..c3a16639b62 100644 --- a/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs +++ b/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs @@ -449,7 +449,7 @@ private static void ScanSourceInterface(ComTypes.ITypeInfo sourceTypeInfo, ref D // adding new events and putting them on new interfaces while keeping the // old interfaces around. This may cause name collisions which we are // resolving by keeping only the first event with the same name. - if (events.ContainsKey(name) == false) + if (!events.ContainsKey(name)) { ComEventDesc eventDesc = new ComEventDesc { diff --git a/src/System.Management.Automation/engine/CommandDiscovery.cs b/src/System.Management.Automation/engine/CommandDiscovery.cs index 873183eb40d..97df9a02f2a 100644 --- a/src/System.Management.Automation/engine/CommandDiscovery.cs +++ b/src/System.Management.Automation/engine/CommandDiscovery.cs @@ -784,7 +784,7 @@ internal static CommandInfo LookupCommandInfo( // Check the module auto-loading preference PSModuleAutoLoadingPreference moduleAutoLoadingPreference = GetCommandDiscoveryPreference(context, SpecialVariables.PSModuleAutoLoadingPreferenceVarPath, "PSModuleAutoLoadingPreference"); - if (eventArgs == null || eventArgs.StopSearch != true) + if (eventArgs == null || !eventArgs.StopSearch) { do { diff --git a/src/System.Management.Automation/engine/CommandMetadata.cs b/src/System.Management.Automation/engine/CommandMetadata.cs index 3396aea65a6..5056f2afbb0 100644 --- a/src/System.Management.Automation/engine/CommandMetadata.cs +++ b/src/System.Management.Automation/engine/CommandMetadata.cs @@ -926,7 +926,7 @@ internal string GetDecl() separator = ", "; } - if (PositionalBinding == false) + if (!PositionalBinding) { decl.Append(separator); decl.Append("PositionalBinding=$false"); diff --git a/src/System.Management.Automation/engine/CommandProcessor.cs b/src/System.Management.Automation/engine/CommandProcessor.cs index 3671638e120..cfc7f861f81 100644 --- a/src/System.Management.Automation/engine/CommandProcessor.cs +++ b/src/System.Management.Automation/engine/CommandProcessor.cs @@ -527,7 +527,7 @@ internal sealed override bool Read() try { // Process the input pipeline object - if (ProcessInputPipelineObject(inputObject) == false) + if (!ProcessInputPipelineObject(inputObject)) { // The input object was not bound to any parameters of the cmdlet. // Write a non-terminating error and continue with the next input diff --git a/src/System.Management.Automation/engine/CoreAdapter.cs b/src/System.Management.Automation/engine/CoreAdapter.cs index f1160639c59..673225b996b 100644 --- a/src/System.Management.Automation/engine/CoreAdapter.cs +++ b/src/System.Management.Automation/engine/CoreAdapter.cs @@ -1395,8 +1395,8 @@ private static MethodInformation FindBestMethodImpl( // We also skip the optimization if the number of arguments and parameters is different // so we let the loop deal with possible optional parameters. if ((methods.Length == 1) && - (methods[0].hasVarArgs == false) && - (methods[0].isGeneric == false) && + (!methods[0].hasVarArgs) && + (!methods[0].isGeneric) && (methods[0].method == null || !(methods[0].method.DeclaringType.IsGenericTypeDefinition)) && // generic methods need to be double checked in a loop below - generic methods can be rejected if type inference fails (methods[0].parameters.Length == arguments.Length)) diff --git a/src/System.Management.Automation/engine/ErrorPackage.cs b/src/System.Management.Automation/engine/ErrorPackage.cs index d35130092fe..4d1627dff93 100644 --- a/src/System.Management.Automation/engine/ErrorPackage.cs +++ b/src/System.Management.Automation/engine/ErrorPackage.cs @@ -1336,7 +1336,7 @@ private void ConstructFromPSObjectForRemoting(PSObject serializedErrorRecord) string errorDetails_ScriptStackTrace = GetNoteValue(serializedErrorRecord, "ErrorDetails_ScriptStackTrace") as string; - RemoteException re = new RemoteException((string.IsNullOrWhiteSpace(exceptionMessage) == false) ? exceptionMessage : errorCategory_Message, serializedException, invocationInfo); + RemoteException re = new RemoteException((!string.IsNullOrWhiteSpace(exceptionMessage)) ? exceptionMessage : errorCategory_Message, serializedException, invocationInfo); // Create ErrorRecord PopulateProperties( diff --git a/src/System.Management.Automation/engine/GetCommandCommand.cs b/src/System.Management.Automation/engine/GetCommandCommand.cs index 369ce76ad06..96be302f5e8 100644 --- a/src/System.Management.Automation/engine/GetCommandCommand.cs +++ b/src/System.Management.Automation/engine/GetCommandCommand.cs @@ -1423,7 +1423,7 @@ private IEnumerable GetMatchingCommandsFromModules(string commandNa { PSModuleInfo module = null; - if (Context.EngineSessionState.ModuleTable.TryGetValue(Context.EngineSessionState.ModuleTableKeys[i], out module) == false) + if (!Context.EngineSessionState.ModuleTable.TryGetValue(Context.EngineSessionState.ModuleTableKeys[i], out module)) { Dbg.Assert(false, "ModuleTableKeys should be in sync with ModuleTable"); } diff --git a/src/System.Management.Automation/engine/LanguagePrimitives.cs b/src/System.Management.Automation/engine/LanguagePrimitives.cs index 322d21faca8..703fbcd46e4 100644 --- a/src/System.Management.Automation/engine/LanguagePrimitives.cs +++ b/src/System.Management.Automation/engine/LanguagePrimitives.cs @@ -4742,7 +4742,7 @@ private static string GetAvailableProperties(PSObject pso) { foreach (PSPropertyInfo p in pso.Properties) { - if (first == false) + if (!first) { availableProperties.Append(" , "); } diff --git a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs index 32d5326a48c..ddc5e2ac478 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs @@ -723,7 +723,7 @@ private PSModuleInfo LoadModuleNamedInManifest(PSModuleInfo parentModule, Module // NestedModules = 'test2' ---> test2 is a directory under current module directory (e.g - Test1) // We also need to look for Test1\Test2\Test2.(psd1/psm1/dll) // With the call above, we are only looking at Test1\Test2.(psd1/psm1/dll) - if (found == false && moduleFileFound == false) + if (!found && !moduleFileFound) { string newRootedPath = Path.Combine(rootedPath, moduleSpecification.Name); string newModuleBase = Path.Combine(moduleBase, moduleSpecification.Name); @@ -764,7 +764,7 @@ private PSModuleInfo LoadModuleNamedInManifest(PSModuleInfo parentModule, Module // Win8: 262157 - Import-Module is giving errors while loading Nested Modules. (This is a V2 bug) // Only look for the file if the file was not found with the previous search - if (found == false && moduleFileFound == false) + if (!found && !moduleFileFound) { string newRootedPath = Path.Combine(rootedPath, moduleSpecification.Name); string newModuleBase = Path.Combine(moduleBase, moduleSpecification.Name); @@ -786,10 +786,10 @@ private PSModuleInfo LoadModuleNamedInManifest(PSModuleInfo parentModule, Module } // The rooted files wasn't found, so don't search anymore... - if (found == false && wasRooted) + if (!found && wasRooted) return null; - if (searchModulePath && found == false && moduleFileFound == false) + if (searchModulePath && !found && !moduleFileFound) { if (VerifyIfNestedModuleIsAvailable(moduleSpecification, null, null, out tempModuleInfoFromVerification)) { @@ -846,7 +846,7 @@ private PSModuleInfo LoadModuleNamedInManifest(PSModuleInfo parentModule, Module // At this point, we haven't found an actual module, so try loading it as a // PSSnapIn and then finally as an assembly in the GAC... - if ((found == false) && (moduleSpecification.Guid == null) && (moduleSpecification.Version == null) && (moduleSpecification.RequiredVersion == null) && (moduleSpecification.MaximumVersion == null)) + if (!found && (moduleSpecification.Guid == null) && (moduleSpecification.Version == null) && (moduleSpecification.RequiredVersion == null) && (moduleSpecification.MaximumVersion == null)) { // If we are in module analysis and the parent module declares non-wildcarded ExportedCmdlets, then we don't need to // actually process the binary module. @@ -4956,7 +4956,7 @@ internal void RemoveModule(PSModuleInfo module, string moduleNameInRemoveModuleC args: new object[] { module }); } - if (module.ImplementingAssembly != null && module.ImplementingAssembly.IsDynamic == false) + if (module.ImplementingAssembly != null && !module.ImplementingAssembly.IsDynamic) { var exportedTypes = PSSnapInHelpers.GetAssemblyTypes(module.ImplementingAssembly, module.Name); foreach (var type in exportedTypes) @@ -6666,7 +6666,7 @@ internal PSModuleInfo LoadBinaryModule(PSModuleInfo parentModule, bool trySnapIn } } - if (importSuccessful == false) + if (!importSuccessful) { if (importingModule) { @@ -7087,7 +7087,7 @@ internal static void AddModuleToModuleTables(ExecutionContext context, SessionSt } var privateDataHashTable = module.PrivateData as Hashtable; - if (context.Modules.IsImplicitRemotingModuleLoaded == false && + if (!context.Modules.IsImplicitRemotingModuleLoaded && privateDataHashTable != null && privateDataHashTable.ContainsKey("ImplicitRemoting")) { context.Modules.IsImplicitRemotingModuleLoaded = true; diff --git a/src/System.Management.Automation/engine/NativeCommandProcessor.cs b/src/System.Management.Automation/engine/NativeCommandProcessor.cs index 0af57e7b420..bcd42658d22 100644 --- a/src/System.Management.Automation/engine/NativeCommandProcessor.cs +++ b/src/System.Management.Automation/engine/NativeCommandProcessor.cs @@ -504,7 +504,7 @@ private void InitNativeProcess() // we will try launching one last time using ShellExecute... if (notDone) { - if (soloCommand && startInfo.UseShellExecute == false) + if (soloCommand && !startInfo.UseShellExecute) { startInfo.UseShellExecute = true; startInfo.RedirectStandardInput = false; @@ -531,7 +531,7 @@ private void InitNativeProcess() else { _isRunningInBackground = true; - if (startInfo.UseShellExecute == false) + if (!startInfo.UseShellExecute) { _isRunningInBackground = isWindowsApplication; } @@ -563,7 +563,7 @@ private void InitNativeProcess() throw; } - if (_isRunningInBackground == false) + if (!_isRunningInBackground) { InitOutputQueue(); } @@ -654,7 +654,7 @@ private ProcessOutputObject DequeueProcessOutput(bool blocking) /// private void ConsumeAvailableNativeProcessOutput(bool blocking) { - if (_isRunningInBackground == false) + if (!_isRunningInBackground) { if (_nativeProcess.StartInfo.RedirectStandardOutput || _nativeProcess.StartInfo.RedirectStandardError) { @@ -678,7 +678,7 @@ internal override void Complete() Exception exceptionToRethrow = null; try { - if (_isRunningInBackground == false) + if (!_isRunningInBackground) { // Wait for input writer to finish. _inputWriter.Done(); @@ -1251,7 +1251,7 @@ private void CalculateIORedirection(bool isWindowsApplication, out bool redirect // In minishell scenario, if output is redirected // then error should also be redirected. - if (redirectError == false && redirectOutput && _isMiniShell) + if (!redirectError && redirectOutput && _isMiniShell) { redirectError = true; } diff --git a/src/System.Management.Automation/engine/SessionStateContainer.cs b/src/System.Management.Automation/engine/SessionStateContainer.cs index 6fbd3b340a8..a2b6f3baffa 100644 --- a/src/System.Management.Automation/engine/SessionStateContainer.cs +++ b/src/System.Management.Automation/engine/SessionStateContainer.cs @@ -628,7 +628,7 @@ internal bool IsItemContainer( foreach (string providerPath in providerPaths) { result = IsItemContainer(providerInstance, providerPath, context); - if (result == false) + if (!result) { break; } diff --git a/src/System.Management.Automation/engine/TypeTable.cs b/src/System.Management.Automation/engine/TypeTable.cs index 06389ddee42..7e47a0444dc 100644 --- a/src/System.Management.Automation/engine/TypeTable.cs +++ b/src/System.Management.Automation/engine/TypeTable.cs @@ -3191,7 +3191,7 @@ private static bool CheckStandardMembers(ConcurrentBag errors, string ty } while (false); - if (serializationSettingsOk == false) + if (!serializationSettingsOk) { AddError(errors, typeName, TypesXmlStrings.SerializationSettingsIgnored); members.Remove(InheritPropertySerializationSet); diff --git a/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs b/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs index 25989f6d4cf..48129196ad8 100644 --- a/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs +++ b/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs @@ -829,7 +829,7 @@ internal void AddToRunningPipelineList(PipelineBase pipeline) lock (_pipelineListLock) { - if (ByPassRunspaceStateCheck == false && RunspaceState != RunspaceState.Opened) + if (!ByPassRunspaceStateCheck && RunspaceState != RunspaceState.Opened) { InvalidRunspaceStateException e = new InvalidRunspaceStateException @@ -1003,7 +1003,7 @@ internal void StopNestedPipelines(Pipeline pipeline) // first check if this pipeline is in the list of running // pipelines. It is possible that pipeline has already // completed. - if (RunningPipelines.Contains(pipeline) == false) + if (!RunningPipelines.Contains(pipeline)) { return; } diff --git a/src/System.Management.Automation/engine/hostifaces/History.cs b/src/System.Management.Automation/engine/hostifaces/History.cs index 499fdbb2ea1..954a90db2b8 100644 --- a/src/System.Management.Automation/engine/hostifaces/History.cs +++ b/src/System.Management.Automation/engine/hostifaces/History.cs @@ -262,7 +262,7 @@ internal HistoryInfo GetEntry(long id) HistoryInfo entry = CoreGetEntry(id); if (entry != null) - if (entry.Cleared == false) + if (!entry.Cleared) return entry.Clone(); return null; @@ -496,7 +496,7 @@ internal HistoryInfo[] GetEntries(WildcardPattern wildcardpattern, long count, S for (long i = 0; i <= count - 1;) { if (id > _countEntriesAdded) break; - if (_buffer[GetIndexFromId(id)].Cleared == false && wildcardpattern.IsMatch(_buffer[GetIndexFromId(id)].CommandLine.Trim())) + if (!_buffer[GetIndexFromId(id)].Cleared && wildcardpattern.IsMatch(_buffer[GetIndexFromId(id)].CommandLine.Trim())) { cmdlist.Add(_buffer[GetIndexFromId(id)].Clone()); i++; } @@ -520,7 +520,7 @@ internal HistoryInfo[] GetEntries(WildcardPattern wildcardpattern, long count, S } if (id < 1) break; - if (_buffer[GetIndexFromId(id)].Cleared == false && wildcardpattern.IsMatch(_buffer[GetIndexFromId(id)].CommandLine.Trim())) + if (!_buffer[GetIndexFromId(id)].Cleared && wildcardpattern.IsMatch(_buffer[GetIndexFromId(id)].CommandLine.Trim())) { cmdlist.Add(_buffer[GetIndexFromId(id)].Clone()); i++; } @@ -533,7 +533,7 @@ internal HistoryInfo[] GetEntries(WildcardPattern wildcardpattern, long count, S { for (long i = 1; i <= _countEntriesAdded; i++) { - if (_buffer[GetIndexFromId(i)].Cleared == false && wildcardpattern.IsMatch(_buffer[GetIndexFromId(i)].CommandLine.Trim())) + if (!_buffer[GetIndexFromId(i)].Cleared && wildcardpattern.IsMatch(_buffer[GetIndexFromId(i)].CommandLine.Trim())) { cmdlist.Add(_buffer[GetIndexFromId(i)].Clone()); } @@ -660,7 +660,7 @@ private long SmallestIDinBuffer() for (int i = 0; i < _buffer.Length; i++) { // assign the first entry in the buffer as min. - if (_buffer[i] != null && _buffer[i].Cleared == false) + if (_buffer[i] != null && !_buffer[i].Cleared) { minID = _buffer[i].Id; break; @@ -669,7 +669,7 @@ private long SmallestIDinBuffer() // check for the minimum id that is not cleared for (int i = 0; i < _buffer.Length; i++) { - if (_buffer[i] != null && _buffer[i].Cleared == false) + if (_buffer[i] != null && !_buffer[i].Cleared) if (minID > _buffer[i].Id) minID = _buffer[i].Id; } @@ -1814,7 +1814,7 @@ private void ClearHistoryByID() else { // confirmation message if all the clearhistory cmdlet is used without any parameters - if (_countParameterSpecified == false) + if (!_countParameterSpecified) { string message = StringUtil.Format(HistoryStrings.ClearHistoryWarning, "Warning");// "The command would clear all the entry(s) from the session history,Are you sure you want to continue ?"; if (!ShouldProcess(message)) @@ -1955,7 +1955,7 @@ private void ClearHistoryEntries(long id, int count, string cmdline, SwitchParam // Clear the History value. foreach (HistoryInfo entry in _entries) { - if (entry != null && entry.Cleared == false) + if (entry != null && !entry.Cleared) _history.ClearEntry(entry.Id); } diff --git a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs index 60b15993eff..e2fbb696100 100644 --- a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs +++ b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs @@ -517,7 +517,7 @@ internal PSInformationalBuffers GetInformationalMessageBuffers() endLoop = false; break; } - } while (endLoop != true); + } while (!endLoop); return shouldContinue; } diff --git a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs index b873ffc32f2..1f4c9433c52 100644 --- a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs +++ b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs @@ -1131,7 +1131,7 @@ protected override { try { - if (_disposed == false) + if (!_disposed) { _disposed = true; if (disposing) diff --git a/src/System.Management.Automation/engine/hostifaces/PSDataCollection.cs b/src/System.Management.Automation/engine/hostifaces/PSDataCollection.cs index 546b7383ce7..2bcd12d218c 100644 --- a/src/System.Management.Automation/engine/hostifaces/PSDataCollection.cs +++ b/src/System.Management.Automation/engine/hostifaces/PSDataCollection.cs @@ -1911,7 +1911,7 @@ public object Current /// public bool MoveNext() { - return MoveNext(_neverBlock == false); + return MoveNext(!_neverBlock); } /// diff --git a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs index bfe9652c1c7..11fc4592fb0 100644 --- a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs +++ b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs @@ -3670,7 +3670,7 @@ public PSDataCollection EndInvoke(IAsyncResult asyncResult) if ((psAsyncResult == null) || (psAsyncResult.OwnerId != InstanceId) || - (psAsyncResult.IsAssociatedWithAsyncInvoke != true)) + (!psAsyncResult.IsAssociatedWithAsyncInvoke)) { throw PSTraceSource.NewArgumentException(nameof(asyncResult), PowerShellStrings.AsyncResultNotOwned, "IAsyncResult", "BeginInvoke"); diff --git a/src/System.Management.Automation/engine/hostifaces/pipelinebase.cs b/src/System.Management.Automation/engine/hostifaces/pipelinebase.cs index 3dfea3a2e3d..2d74430a40a 100644 --- a/src/System.Management.Automation/engine/hostifaces/pipelinebase.cs +++ b/src/System.Management.Automation/engine/hostifaces/pipelinebase.cs @@ -618,7 +618,7 @@ internal void DoConcurrentCheck(bool syncCall, object syncObject, bool isInLock) { PipelineBase currentPipeline = (PipelineBase)RunspaceBase.GetCurrentlyRunningPipeline(); - if (IsNested == false) + if (!IsNested) { if (currentPipeline == null) { @@ -665,7 +665,7 @@ internal void DoConcurrentCheck(bool syncCall, object syncObject, bool isInLock) { if (_performNestedCheck) { - if (syncCall == false) + if (!syncCall) { throw PSTraceSource.NewInvalidOperationException( RunspaceStrings.NestedPipelineInvokeAsync); @@ -690,7 +690,7 @@ internal void DoConcurrentCheck(bool syncCall, object syncObject, bool isInLock) Dbg.Assert(currentPipeline.NestedPipelineExecutionThread != null, "Current pipeline should always have NestedPipelineExecutionThread set"); Thread th = Thread.CurrentThread; - if (currentPipeline.NestedPipelineExecutionThread.Equals(th) == false) + if (!currentPipeline.NestedPipelineExecutionThread.Equals(th)) { throw PSTraceSource.NewInvalidOperationException( RunspaceStrings.NestedPipelineNoParentPipeline); @@ -1046,7 +1046,7 @@ protected override { try { - if (_disposed == false) + if (!_disposed) { _disposed = true; if (disposing) diff --git a/src/System.Management.Automation/engine/parser/Parser.cs b/src/System.Management.Automation/engine/parser/Parser.cs index e30dee24fe4..995418f8061 100644 --- a/src/System.Management.Automation/engine/parser/Parser.cs +++ b/src/System.Management.Automation/engine/parser/Parser.cs @@ -198,7 +198,7 @@ private ScriptBlockAst ParseTask(string fileName, string input, List toke } catch (InsufficientExecutionStackException) { - if (recursed == false) + if (!recursed) { // We'll try parsing once more, this time on a new thread. The assumption here is // that the stack was close to overflowing before we tried to parse, and that won't diff --git a/src/System.Management.Automation/engine/remoting/client/Job.cs b/src/System.Management.Automation/engine/remoting/client/Job.cs index a616b22a926..a7529207428 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job.cs @@ -3469,11 +3469,11 @@ protected override void Dispose(bool disposing) protected virtual void DoCleanupOnFinished() { bool doCleanup = false; - if (_cleanupDone == false) + if (!_cleanupDone) { lock (SyncObject) { - if (_cleanupDone == false) + if (!_cleanupDone) { _cleanupDone = true; doCleanup = true; @@ -4225,11 +4225,11 @@ internal PSInvokeExpressionSyncJob(List operations, Throttle protected override void DoCleanupOnFinished() { bool doCleanup = false; - if (_cleanupDone == false) + if (!_cleanupDone) { lock (SyncObject) { - if (_cleanupDone == false) + if (!_cleanupDone) { _cleanupDone = true; doCleanup = true; diff --git a/src/System.Management.Automation/engine/remoting/client/JobManager.cs b/src/System.Management.Automation/engine/remoting/client/JobManager.cs index 6ef47c19752..b2e4f0d6454 100644 --- a/src/System.Management.Automation/engine/remoting/client/JobManager.cs +++ b/src/System.Management.Automation/engine/remoting/client/JobManager.cs @@ -643,7 +643,7 @@ private bool CheckTypeNames(JobSourceAdapter sourceAdapter, string[] jobSourceAd private string GetAdapterName(JobSourceAdapter sourceAdapter) { - return (string.IsNullOrEmpty(sourceAdapter.Name) == false ? + return (!string.IsNullOrEmpty(sourceAdapter.Name) ? sourceAdapter.Name : sourceAdapter.GetType().ToString()); } diff --git a/src/System.Management.Automation/engine/remoting/client/PowerShellStreams.cs b/src/System.Management.Automation/engine/remoting/client/PowerShellStreams.cs index 288bc1449e9..df859a7bc2b 100644 --- a/src/System.Management.Automation/engine/remoting/client/PowerShellStreams.cs +++ b/src/System.Management.Automation/engine/remoting/client/PowerShellStreams.cs @@ -238,11 +238,11 @@ public PSDataCollection InformationStream /// public void CloseAll() { - if (_disposed == false) + if (!_disposed) { lock (_syncLock) { - if (_disposed == false) + if (!_disposed) { _outputStream.Complete(); _errorStream.Complete(); diff --git a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs index cc2b81a896f..adacc285f5f 100644 --- a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs +++ b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs @@ -1268,7 +1268,7 @@ internal static RunspacePool[] GetRemoteRunspacePools(RunspaceConnectionInfo con Guid shellId = Guid.Parse(pspShellId.Value.ToString()); // Filter returned items for PowerShell sessions. - if (strShellUri.StartsWith(WSManNativeApi.ResourceURIPrefix, StringComparison.OrdinalIgnoreCase) == false) + if (!strShellUri.StartsWith(WSManNativeApi.ResourceURIPrefix, StringComparison.OrdinalIgnoreCase)) { continue; } diff --git a/src/System.Management.Automation/engine/remoting/client/clientremotesessionprotocolstatemachine.cs b/src/System.Management.Automation/engine/remoting/client/clientremotesessionprotocolstatemachine.cs index ec55f22fc22..b3de2795bff 100644 --- a/src/System.Management.Automation/engine/remoting/client/clientremotesessionprotocolstatemachine.cs +++ b/src/System.Management.Automation/engine/remoting/client/clientremotesessionprotocolstatemachine.cs @@ -277,7 +277,7 @@ private void SetStateHandler(object sender, RemoteSessionStateMachineEventArgs e Dbg.Assert(_state >= RemoteSessionState.Established, "Client can send a public key only after reaching the Established state"); - Dbg.Assert(_keyExchanged == false, "Client should do key exchange only once"); + Dbg.Assert(!_keyExchanged, "Client should do key exchange only once"); if (_state == RemoteSessionState.Established || _state == RemoteSessionState.EstablishedAndKeyRequested) diff --git a/src/System.Management.Automation/engine/remoting/client/remotepipeline.cs b/src/System.Management.Automation/engine/remoting/client/remotepipeline.cs index 58931499610..ae83f6e871f 100644 --- a/src/System.Management.Automation/engine/remoting/client/remotepipeline.cs +++ b/src/System.Management.Automation/engine/remoting/client/remotepipeline.cs @@ -1048,7 +1048,7 @@ internal void DoConcurrentCheck(bool syncCall) RemotePipeline currentPipeline = (RemotePipeline)((RemoteRunspace)_runspace).GetCurrentlyRunningPipeline(); - if (_isNested == false) + if (!_isNested) { if (currentPipeline == null && ((RemoteRunspace)_runspace).RunspaceAvailability != RunspaceAvailability.Busy && @@ -1093,7 +1093,7 @@ internal void DoConcurrentCheck(bool syncCall) return; } - if (syncCall == false) + if (!syncCall) { throw PSTraceSource.NewInvalidOperationException( RunspaceStrings.NestedPipelineInvokeAsync); diff --git a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs index cbedc14c2a6..6b603a3c45c 100644 --- a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs +++ b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs @@ -1113,7 +1113,7 @@ internal void AddToRunningPipelineList(RemotePipeline pipeline) lock (_syncRoot) { - if (_bypassRunspaceStateCheck == false && + if (!_bypassRunspaceStateCheck && _runspaceStateInfo.State != RunspaceState.Opened && _runspaceStateInfo.State != RunspaceState.Disconnected) // Disconnected runspaces can have running pipelines. { diff --git a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs index 8ba2ccc4db8..55a0d643210 100644 --- a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs +++ b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs @@ -869,7 +869,7 @@ private string ConstructPluginContent(out string srcConfigFilePath, out string d if (configTable.ContainsKey(ConfigFileConstants.PowerShellVersion)) { - if (isPSVersionSpecified == false) + if (!isPSVersionSpecified) { try { @@ -1071,7 +1071,7 @@ private string ConstructPluginContent(out string srcConfigFilePath, out string d } // Default value for PSVersion - if (isPSVersionSpecified == false) + if (!isPSVersionSpecified) { psVersion = PSVersionInfo.PSVersion; } diff --git a/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs b/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs index 5166dcf32bd..ad002640306 100644 --- a/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs +++ b/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs @@ -972,7 +972,7 @@ protected override void BeginProcessing() // of this bug in Win8 where not responding can occur during data piping. // We are reverting to Win7 behavior for {icm | icm} and {proxycommand | proxycommand} // cases. For ICM | % ICM case, we are using remote steppable pipeline. - if ((MyInvocation != null) && (MyInvocation.PipelinePosition == 1) && (MyInvocation.ExpectingInput == false)) + if ((MyInvocation != null) && (MyInvocation.PipelinePosition == 1) && !MyInvocation.ExpectingInput) { PSPrimitiveDictionary table = (object)runspaceInfo.ApplicationPrivateData[PSVersionInfo.PSVersionTableName] as PSPrimitiveDictionary; if (table != null) diff --git a/src/System.Management.Automation/engine/remoting/common/AsyncObject.cs b/src/System.Management.Automation/engine/remoting/common/AsyncObject.cs index a68a6f78869..2ba391efdfc 100644 --- a/src/System.Management.Automation/engine/remoting/common/AsyncObject.cs +++ b/src/System.Management.Automation/engine/remoting/common/AsyncObject.cs @@ -32,7 +32,7 @@ internal T Value get { bool result = _valueWasSet.WaitOne(); - if (result == false) + if (!result) { _value = null; } diff --git a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs index 486383ec4dc..2bcfd3a8aae 100644 --- a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs +++ b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs @@ -831,7 +831,7 @@ private void HandleCreateAndInvokePowerShell(object _, RemoteDataEventArgs or . In // this case isEmpty is false. - if (isEmpty == false && _reader.NodeType == XmlNodeType.EndElement) + if (!isEmpty && _reader.NodeType == XmlNodeType.EndElement) { ReadEndElement(); isEmpty = true; diff --git a/src/System.Management.Automation/utils/tracing/SysLogProvider.cs b/src/System.Management.Automation/utils/tracing/SysLogProvider.cs index 5796bd22159..ba88f595324 100755 --- a/src/System.Management.Automation/utils/tracing/SysLogProvider.cs +++ b/src/System.Management.Automation/utils/tracing/SysLogProvider.cs @@ -153,7 +153,7 @@ private static Guid Activity { get { - if (t_activity.HasValue == false) + if (!t_activity.HasValue) { // NOTE: Thread static fields must be explicitly initialized for each thread. t_activity = Guid.NewGuid();