diff --git a/.globalconfig b/.globalconfig
index e853c28d46..1deb8dd7fb 100644
--- a/.globalconfig
+++ b/.globalconfig
@@ -952,7 +952,7 @@ dotnet_diagnostic.IDE0073.severity = suggestion
dotnet_diagnostic.IDE0074.severity = warning
# IDE0075: SimplifyConditionalExpression
-dotnet_diagnostic.IDE0075.severity = silent
+dotnet_diagnostic.IDE0075.severity = warning
# IDE0076: InvalidSuppressMessageAttribute
dotnet_diagnostic.IDE0076.severity = silent
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
index 4b86f9d1a2..cbd9d4c36b 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
@@ -358,7 +358,7 @@ namespace Microsoft.PowerShell.Commands
{
using (StreamReader streamReader = PathUtils.OpenStreamReader(this, this.Path, Encoding, _isLiteralPath))
{
- isCsvFileEmpty = streamReader.Peek() == -1 ? true : false;
+ isCsvFileEmpty = streamReader.Peek() == -1;
}
}
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
index 7c2fdbe0c1..053f99f897 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
@@ -72,7 +72,7 @@ namespace Microsoft.PowerShell.Commands
}
index = 0;
- bool addErrorIdentifier = errorRecords.Count > 1 ? true : false;
+ bool addErrorIdentifier = errorRecords.Count > 1;
foreach (object errorRecord in errorRecords)
{
diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs
index 7918f6f681..65f0267d0e 100644
--- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs
+++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs
@@ -208,8 +208,7 @@ namespace Microsoft.PowerShell
bool sizeChanged =
(newRegion.GetLength(0) != _progressRegion.GetLength(0))
- || (newRegion.GetLength(1) != _progressRegion.GetLength(1))
- ? true : false;
+ || (newRegion.GetLength(1) != _progressRegion.GetLength(1));
_progressRegion = newRegion;
diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs
index 072e693562..5b8bd88d0f 100644
--- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs
+++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs
@@ -202,7 +202,7 @@ namespace System.Diagnostics.Eventing
///
public bool IsEnabled()
{
- return (_enabled != 0) ? true : false;
+ return _enabled != 0;
}
///
diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs
index 720af78064..ee29eb8ab1 100644
--- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs
+++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs
@@ -1396,7 +1396,7 @@ namespace System.Diagnostics.Eventing.Reader
bool[] array = new bool[val.Count];
for (int i = 0; i < val.Count; i++)
{
- bool value = (Marshal.ReadInt32(ptr) != 0) ? true : false;
+ bool value = Marshal.ReadInt32(ptr) != 0;
array[i] = value;
ptr = new IntPtr((Int64)ptr + 4);
}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/EmphasisInlineRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/EmphasisInlineRenderer.cs
index b1c4777a19..95a2bd1c7e 100644
--- a/src/Microsoft.PowerShell.MarkdownRender/EmphasisInlineRenderer.cs
+++ b/src/Microsoft.PowerShell.MarkdownRender/EmphasisInlineRenderer.cs
@@ -12,7 +12,7 @@ namespace Microsoft.PowerShell.MarkdownRender
{
protected override void Write(VT100Renderer renderer, EmphasisInline obj)
{
- renderer.Write(renderer.EscapeSequences.FormatEmphasis(obj.FirstChild.ToString(), isBold: obj.DelimiterCount == 2 ? true : false));
+ renderer.Write(renderer.EscapeSequences.FormatEmphasis(obj.FirstChild.ToString(), isBold: obj.DelimiterCount == 2));
}
}
}
diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormattingObjectsDeserializer.cs b/src/System.Management.Automation/FormatAndOutput/common/FormattingObjectsDeserializer.cs
index d1b9523138..285e4d4c02 100644
--- a/src/System.Management.Automation/FormatAndOutput/common/FormattingObjectsDeserializer.cs
+++ b/src/System.Management.Automation/FormatAndOutput/common/FormattingObjectsDeserializer.cs
@@ -290,7 +290,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
internal bool DeserializeBoolMemberVariable(PSObject so, string property, bool cannotBeNull = true)
{
var val = DeserializeMemberVariable(so, property, typeof(bool), cannotBeNull);
- return (val == null) ? false : (bool)val;
+ return val != null && (bool)val;
}
internal WriteStreamType DeserializeWriteStreamTypeMemberVariable(PSObject so)
diff --git a/src/System.Management.Automation/engine/CommandParameter.cs b/src/System.Management.Automation/engine/CommandParameter.cs
index b13cc94ad4..e6752ff023 100644
--- a/src/System.Management.Automation/engine/CommandParameter.cs
+++ b/src/System.Management.Automation/engine/CommandParameter.cs
@@ -116,7 +116,7 @@ namespace System.Management.Automation
///
internal bool ArgumentToBeSplatted
{
- get { return _argument != null ? _argument.splatted : false; }
+ get { return _argument != null && _argument.splatted; }
}
///
diff --git a/src/System.Management.Automation/engine/ExecutionContext.cs b/src/System.Management.Automation/engine/ExecutionContext.cs
index 3f8156e32a..9c484a7c56 100644
--- a/src/System.Management.Automation/engine/ExecutionContext.cs
+++ b/src/System.Management.Automation/engine/ExecutionContext.cs
@@ -113,9 +113,7 @@ namespace System.Management.Automation
context = LocalPipeline.GetExecutionContextFromTLS();
}
- return (context != null)
- ? context.IsStrictVersion(majorVersion)
- : false;
+ return (context != null) && context.IsStrictVersion(majorVersion);
}
///
/// Check to see a specific version of strict mode is enabled. The check is always scoped,
@@ -488,7 +486,7 @@ namespace System.Management.Automation
{
get
{
- return InitialSessionState != null ? InitialSessionState.UseFullLanguageModeInDebugger : false;
+ return InitialSessionState != null && InitialSessionState.UseFullLanguageModeInDebugger;
}
}
diff --git a/src/System.Management.Automation/engine/ExternalScriptInfo.cs b/src/System.Management.Automation/engine/ExternalScriptInfo.cs
index 03e17d74dd..b97da3b997 100644
--- a/src/System.Management.Automation/engine/ExternalScriptInfo.cs
+++ b/src/System.Management.Automation/engine/ExternalScriptInfo.cs
@@ -443,7 +443,7 @@ namespace System.Management.Automation
get
{
var data = GetRequiresData();
- return data == null ? false : data.IsElevationRequired;
+ return data != null && data.IsElevationRequired;
}
}
diff --git a/src/System.Management.Automation/engine/GetCommandCommand.cs b/src/System.Management.Automation/engine/GetCommandCommand.cs
index 96be302f5e..17efeb4ac7 100644
--- a/src/System.Management.Automation/engine/GetCommandCommand.cs
+++ b/src/System.Management.Automation/engine/GetCommandCommand.cs
@@ -1632,8 +1632,7 @@ namespace Microsoft.PowerShell.Commands
new ArrayList(Enum.GetValues(parameterType)) : new ArrayList();
returnParameterType.Properties.Add(new PSNoteProperty("EnumValues", enumValues));
- bool hasFlagAttribute = (isArray) ?
- ((parameterType.GetCustomAttributes(typeof(FlagsAttribute), true)).Length > 0) : false;
+ bool hasFlagAttribute = (isArray) && ((parameterType.GetCustomAttributes(typeof(FlagsAttribute), true)).Length > 0);
returnParameterType.Properties.Add(new PSNoteProperty("HasFlagAttribute", hasFlagAttribute));
// Recurse into array elements.
diff --git a/src/System.Management.Automation/engine/ScriptCommandProcessor.cs b/src/System.Management.Automation/engine/ScriptCommandProcessor.cs
index 6b2e4d5d81..99b685e07d 100644
--- a/src/System.Management.Automation/engine/ScriptCommandProcessor.cs
+++ b/src/System.Management.Automation/engine/ScriptCommandProcessor.cs
@@ -274,7 +274,7 @@ namespace System.Management.Automation
{
_scriptBlock = base._scriptBlock;
_obsoleteAttribute = _scriptBlock.ObsoleteAttribute;
- _runOptimizedCode = _scriptBlock.Compile(optimized: _context._debuggingMode > 0 ? false : UseLocalScope);
+ _runOptimizedCode = _scriptBlock.Compile(optimized: _context._debuggingMode <= 0 && UseLocalScope);
_localsTuple = _scriptBlock.MakeLocalsTuple(_runOptimizedCode);
if (UseLocalScope)
diff --git a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs
index 96379ee853..b30d64d04d 100644
--- a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs
+++ b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs
@@ -78,7 +78,7 @@ namespace System.Management.Automation.Internal.Host
public override bool SupportsVirtualTerminal
{
- get { return (_externalUI != null) ? _externalUI.SupportsVirtualTerminal : false; }
+ get { return _externalUI != null && _externalUI.SupportsVirtualTerminal; }
}
///
diff --git a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs
index 627ca221fa..a76dbe1c0b 100644
--- a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs
+++ b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs
@@ -5546,7 +5546,7 @@ namespace System.Management.Automation
LocalPipeline localPipeline = new LocalPipeline(
lrs,
_shell.Commands.Commands,
- ((_settings != null) && (_settings.AddToHistory)) ? true : false,
+ (_settings != null && _settings.AddToHistory),
_shell.IsNested,
_inputStream,
_outputStream,
diff --git a/src/System.Management.Automation/engine/parser/ast.cs b/src/System.Management.Automation/engine/parser/ast.cs
index 60fac20f4b..b9404afa73 100644
--- a/src/System.Management.Automation/engine/parser/ast.cs
+++ b/src/System.Management.Automation/engine/parser/ast.cs
@@ -3449,7 +3449,7 @@ namespace System.Management.Automation.Language
if (ReturnType == null)
return true;
var typeName = ReturnType.TypeName as TypeName;
- return typeName == null ? false : typeName.IsType(typeof(void));
+ return typeName != null && typeName.IsType(typeof(void));
}
internal Type GetReturnType()
diff --git a/src/System.Management.Automation/engine/remoting/client/ClientMethodExecutor.cs b/src/System.Management.Automation/engine/remoting/client/ClientMethodExecutor.cs
index b6c794f547..120ca07a5a 100644
--- a/src/System.Management.Automation/engine/remoting/client/ClientMethodExecutor.cs
+++ b/src/System.Management.Automation/engine/remoting/client/ClientMethodExecutor.cs
@@ -98,8 +98,7 @@ namespace System.Management.Automation.Remoting
if (hostPrivateData != null)
{
PSNoteProperty allowSetShouldExit = hostPrivateData.Properties["AllowSetShouldExitFromRemote"] as PSNoteProperty;
- hostAllowSetShouldExit = (allowSetShouldExit != null && allowSetShouldExit.Value is bool) ?
- (bool)allowSetShouldExit.Value : false;
+ hostAllowSetShouldExit = allowSetShouldExit != null && allowSetShouldExit.Value is bool && (bool)allowSetShouldExit.Value;
}
}
diff --git a/src/System.Management.Automation/engine/remoting/client/Job.cs b/src/System.Management.Automation/engine/remoting/client/Job.cs
index 6ca8ec75f4..7fcc78a1c7 100644
--- a/src/System.Management.Automation/engine/remoting/client/Job.cs
+++ b/src/System.Management.Automation/engine/remoting/client/Job.cs
@@ -2968,7 +2968,7 @@ namespace System.Management.Automation
get
{
RemoteRunspace remoteRS = Runspace as RemoteRunspace;
- return (remoteRS != null) ? remoteRS.CanDisconnect : false;
+ return remoteRS != null && remoteRS.CanDisconnect;
}
}
diff --git a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs
index 2e23d8ac66..94584c613f 100644
--- a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs
+++ b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs
@@ -1426,8 +1426,7 @@ namespace System.Management.Automation.Runspaces.Internal
string compressionModeString = pspCompressionMode.Value as string;
if (compressionModeString != null)
{
- wsmanConnectionInfo.UseCompression = compressionModeString.Equals("NoCompression", StringComparison.OrdinalIgnoreCase)
- ? false : true;
+ wsmanConnectionInfo.UseCompression = !compressionModeString.Equals("NoCompression", StringComparison.OrdinalIgnoreCase);
}
}
@@ -1436,8 +1435,7 @@ namespace System.Management.Automation.Runspaces.Internal
string encodingString = pspEncoding.Value as string;
if (encodingString != null)
{
- wsmanConnectionInfo.UseUTF16 = encodingString.Equals("UTF16", StringComparison.OrdinalIgnoreCase)
- ? true : false;
+ wsmanConnectionInfo.UseUTF16 = encodingString.Equals("UTF16", StringComparison.OrdinalIgnoreCase);
}
}
@@ -1446,8 +1444,7 @@ namespace System.Management.Automation.Runspaces.Internal
string machineProfileLoadedString = pspProfile.Value as string;
if (machineProfileLoadedString != null)
{
- wsmanConnectionInfo.NoMachineProfile = machineProfileLoadedString.Equals("Yes", StringComparison.OrdinalIgnoreCase)
- ? false : true;
+ wsmanConnectionInfo.NoMachineProfile = !machineProfileLoadedString.Equals("Yes", StringComparison.OrdinalIgnoreCase);
}
}
diff --git a/src/System.Management.Automation/engine/remoting/client/RemotingProtocol2.cs b/src/System.Management.Automation/engine/remoting/client/RemotingProtocol2.cs
index 512189dd71..8b8908b6e6 100644
--- a/src/System.Management.Automation/engine/remoting/client/RemotingProtocol2.cs
+++ b/src/System.Management.Automation/engine/remoting/client/RemotingProtocol2.cs
@@ -233,7 +233,7 @@ namespace System.Management.Automation.Internal
// Find out if this is an invoke and disconnect operation and if so whether the endpoint
// supports disconnect. Throw exception if disconnect is not supported.
- bool invokeAndDisconnect = (shell.Settings != null) ? shell.Settings.InvokeAndDisconnect : false;
+ bool invokeAndDisconnect = shell.Settings != null && shell.Settings.InvokeAndDisconnect;
if (invokeAndDisconnect && !EndpointSupportsDisconnect)
{
throw new PSRemotingDataStructureException(RemotingErrorIdStrings.EndpointDoesNotSupportDisconnect);
@@ -938,7 +938,7 @@ namespace System.Management.Automation.Internal
get
{
WSManClientSessionTransportManager wsmanTransportManager = _transportManager as WSManClientSessionTransportManager;
- return (wsmanTransportManager != null) ? wsmanTransportManager.SupportsDisconnect : false;
+ return wsmanTransportManager != null && wsmanTransportManager.SupportsDisconnect;
}
}
diff --git a/src/System.Management.Automation/engine/remoting/client/RunspaceRef.cs b/src/System.Management.Automation/engine/remoting/client/RunspaceRef.cs
index 8fb2fc014d..dfd1cd3bf7 100644
--- a/src/System.Management.Automation/engine/remoting/client/RunspaceRef.cs
+++ b/src/System.Management.Automation/engine/remoting/client/RunspaceRef.cs
@@ -93,7 +93,7 @@ namespace System.Management.Automation.Remoting
// and if we are not in a loopback configuration mode, in which case we always force remote script commands
// to be parsed and evaluated on the remote session (not in the current local session).
RemoteRunspace remoteRunspace = _runspaceRef.Value as RemoteRunspace;
- bool isConfiguredLoopback = (remoteRunspace != null) ? remoteRunspace.IsConfiguredLoopBack : false;
+ bool isConfiguredLoopback = remoteRunspace != null && remoteRunspace.IsConfiguredLoopBack;
bool isTrustedInput = !isConfiguredLoopback && (localRunspace.ExecutionContext.LanguageMode == PSLanguageMode.FullLanguage);
// Create PowerShell from ScriptBlock.
diff --git a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs
index 9cbd8afbc3..bbb2056189 100644
--- a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs
@@ -3003,9 +3003,9 @@ namespace Microsoft.PowerShell.Commands
var matchingRunspaceInfos = remoteRunspaceInfos
.Where(session => (supportWildChar ? inputNamePattern.IsMatch(session.VMName)
: inputName.Equals(session.ContainerId)) &&
- ((sessionNamePattern == null) ? true : sessionNamePattern.IsMatch(session.Name)) &&
+ (sessionNamePattern == null || sessionNamePattern.IsMatch(session.Name)) &&
QueryRunspaces.TestRunspaceState(session.Runspace, filterState) &&
- ((configurationNamePattern == null) ? true : configurationNamePattern.IsMatch(session.ConfigurationName)) &&
+ (configurationNamePattern == null || configurationNamePattern.IsMatch(session.ConfigurationName)) &&
(session.ComputerType == computerType))
.ToList();
@@ -3063,7 +3063,7 @@ namespace Microsoft.PowerShell.Commands
: inputName.Equals(session.ContainerId)) &&
sessionInstanceId.Equals(session.InstanceId) &&
QueryRunspaces.TestRunspaceState(session.Runspace, filterState) &&
- ((configurationNamePattern == null) ? true : configurationNamePattern.IsMatch(session.ConfigurationName)) &&
+ (configurationNamePattern == null || configurationNamePattern.IsMatch(session.ConfigurationName)) &&
(session.ComputerType == computerType))
.ToList();
@@ -3106,9 +3106,9 @@ namespace Microsoft.PowerShell.Commands
var matchingRunspaceInfos = remoteRunspaceInfos
.Where(session => vmId.Equals(session.VMId) &&
- ((sessionNamePattern == null) ? true : sessionNamePattern.IsMatch(session.Name)) &&
+ (sessionNamePattern == null || sessionNamePattern.IsMatch(session.Name)) &&
QueryRunspaces.TestRunspaceState(session.Runspace, filterState) &&
- ((configurationNamePattern == null) ? true : configurationNamePattern.IsMatch(session.ConfigurationName)) &&
+ (configurationNamePattern == null || configurationNamePattern.IsMatch(session.ConfigurationName)) &&
(session.ComputerType == TargetMachineType.VirtualMachine))
.ToList();
@@ -3143,7 +3143,7 @@ namespace Microsoft.PowerShell.Commands
.Where(session => vmId.Equals(session.VMId) &&
sessionInstanceId.Equals(session.InstanceId) &&
QueryRunspaces.TestRunspaceState(session.Runspace, filterState) &&
- ((configurationNamePattern == null) ? true : configurationNamePattern.IsMatch(session.ConfigurationName)) &&
+ (configurationNamePattern == null || configurationNamePattern.IsMatch(session.ConfigurationName)) &&
(session.ComputerType == TargetMachineType.VirtualMachine))
.ToList();
diff --git a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs
index 9ce1cb4b08..3122d7e117 100644
--- a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs
@@ -661,7 +661,7 @@ namespace Microsoft.PowerShell.Commands
if (originalWSManConnectionInfo != null)
{
newWSManConnectionInfo = originalWSManConnectionInfo.Copy();
- newWSManConnectionInfo.EnableNetworkAccess = (newWSManConnectionInfo.EnableNetworkAccess || EnableNetworkAccess) ? true : false;
+ newWSManConnectionInfo.EnableNetworkAccess = newWSManConnectionInfo.EnableNetworkAccess || EnableNetworkAccess;
newConnectionInfo = newWSManConnectionInfo;
}
else
diff --git a/src/System.Management.Automation/engine/remoting/common/fragmentor.cs b/src/System.Management.Automation/engine/remoting/common/fragmentor.cs
index abcb32966f..4685af1e75 100644
--- a/src/System.Management.Automation/engine/remoting/common/fragmentor.cs
+++ b/src/System.Management.Automation/engine/remoting/common/fragmentor.cs
@@ -105,7 +105,7 @@ namespace System.Management.Automation.Remoting
ObjectId = objectId;
FragmentId = fragmentId;
- IsStartFragment = (fragmentId == 0) ? true : false;
+ IsStartFragment = fragmentId == 0;
IsEndFragment = isEndFragment;
_blob = blob;
diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs
index e980de069d..20db6a1dd1 100644
--- a/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs
+++ b/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs
@@ -1925,7 +1925,7 @@ namespace System.Management.Automation.Remoting.Client
}
// check if the session supports disconnect
- sessionTM.SupportsDisconnect = ((flags & (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_SHELL_SUPPORTS_DISCONNECT) != 0) ? true : false;
+ sessionTM.SupportsDisconnect = (flags & (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_SHELL_SUPPORTS_DISCONNECT) != 0;
// openContent is used by redirection ie., while redirecting to
// a new machine.. this is not needed anymore as the connection
diff --git a/src/System.Management.Automation/engine/remoting/server/ServerRemoteHost.cs b/src/System.Management.Automation/engine/remoting/server/ServerRemoteHost.cs
index 9ad9967bf0..ca7ff805c0 100644
--- a/src/System.Management.Automation/engine/remoting/server/ServerRemoteHost.cs
+++ b/src/System.Management.Automation/engine/remoting/server/ServerRemoteHost.cs
@@ -335,7 +335,7 @@ namespace System.Management.Automation.Remoting
// PSEdit support. Existence of RemoteSessionOpenFileEvent event indicates host supports PSEdit
_hostSupportsPSEdit = false;
PSEventManager localEventManager = Runspace?.Events;
- _hostSupportsPSEdit = (localEventManager != null) ? localEventManager.GetEventSubscribers(HostUtilities.RemoteSessionOpenFileEvent).GetEnumerator().MoveNext() : false;
+ _hostSupportsPSEdit = localEventManager != null && localEventManager.GetEventSubscribers(HostUtilities.RemoteSessionOpenFileEvent).GetEnumerator().MoveNext();
if (_hostSupportsPSEdit)
{
AddPSEditForRunspace(remoteRunspace);
diff --git a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs
index b70f0cb4b4..21cb200e56 100644
--- a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs
+++ b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs
@@ -1486,9 +1486,7 @@ namespace System.Management.Automation
Breakpoint breakpoint = serverRemoteDebugger.GetBreakpoint(breakpointId, runspaceId);
preProcessOutput.Add(
- breakpoint == null
- ? false
- : serverRemoteDebugger.RemoveBreakpoint(breakpoint, runspaceId));
+ breakpoint != null && serverRemoteDebugger.RemoveBreakpoint(breakpoint, runspaceId));
result = PreProcessCommandResult.BreakpointManagement;
}
@@ -1628,7 +1626,7 @@ namespace System.Management.Automation
pump = null;
}
- return (pump != null) ? !(pump.IsBusy) : false;
+ return (pump != null) && !(pump.IsBusy);
}
}
diff --git a/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs b/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs
index 133dd10c38..97625a9e46 100644
--- a/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs
+++ b/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs
@@ -1004,7 +1004,7 @@ namespace System.Management.Automation
args = Array.Empty