Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ dotnet_diagnostic.IDE0052.severity = silent
dotnet_diagnostic.IDE0053.severity = silent

# IDE0054: UseCompoundAssignment
dotnet_diagnostic.IDE0054.severity = silent
dotnet_diagnostic.IDE0054.severity = warning

# IDE0055: Formatting
dotnet_diagnostic.IDE0055.severity = silent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,7 @@ private Process StartWithCreateProcess(ProcessStartInfo startinfo)
message = StringUtil.Format(ProcessResources.InvalidStartProcess, win32ex.Message);
}

er = er ?? new ErrorRecord(new InvalidOperationException(message), "InvalidOperationException", ErrorCategory.InvalidOperation, null);
er ??= new ErrorRecord(new InvalidOperationException(message), "InvalidOperationException", ErrorCategory.InvalidOperation, null);
ThrowTerminatingError(er);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private void SetClipboardContent(List<string> contentList, bool append)
if (verboseString.Length >= 20)
{
verboseString = verboseString.Substring(0, 20);
verboseString = verboseString + " ...";
verboseString += " ...";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ protected override void ProcessRecord()
memberCount++;
}

memberCountHelper = memberCountHelper >> 1;
memberCountHelper >>= 1;
}

if (memberCount != 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private double GetRandomDouble(double minValue, double maxValue)
{
double r = Generator.NextDouble();
randomNumber = minValue + r * diff;
diff = diff * r;
diff *= r;
}
while (randomNumber >= maxValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2430,7 +2430,7 @@ private void GenerateHelperFunctionsGetImplicitRunspace(TextWriter writer)
out hashString,
ImplicitRemotingCommandBase.ImplicitRemotingKey,
ImplicitRemotingCommandBase.ImplicitRemotingHashKey);
hashString = hashString ?? string.Empty;
hashString ??= string.Empty;

writer.Write(
HelperFunctionsGetImplicitRunspaceTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2670,19 +2670,19 @@ private CertificateFilterInfo GetFilter()

if (dp.DocumentEncryptionCert)
{
filter = filter ?? new CertificateFilterInfo();
filter ??= new CertificateFilterInfo();
filter.Purpose = CertificatePurpose.DocumentEncryption;
}

if (dp.DnsName != null)
{
filter = filter ?? new CertificateFilterInfo();
filter ??= new CertificateFilterInfo();
filter.DnsName = new WildcardPattern(dp.DnsName, WildcardOptions.IgnoreCase);
}

if (dp.Eku != null)
{
filter = filter ?? new CertificateFilterInfo();
filter ??= new CertificateFilterInfo();
filter.Eku = new List<WildcardPattern>();
foreach (var pattern in dp.Eku)
{
Expand All @@ -2692,13 +2692,13 @@ private CertificateFilterInfo GetFilter()

if (dp.ExpiringInDays >= 0)
{
filter = filter ?? new CertificateFilterInfo();
filter ??= new CertificateFilterInfo();
filter.Expiring = DateTime.Now.AddDays(dp.ExpiringInDays);
}

if (dp.SSLServerAuthentication)
{
filter = filter ?? new CertificateFilterInfo();
filter ??= new CertificateFilterInfo();
filter.SSLServerAuthentication = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.PowerShell.Security/security/CmsCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ private string Decrypt(string actualContent)

if (postContext != null)
{
resultString = resultString + postContext;
resultString += postContext;
}
}

Expand Down
24 changes: 12 additions & 12 deletions src/Microsoft.WSMan.Management/ConfigProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ WsMan Config Can be divided in to Four Fixed Regions to Check Whether it has Chi
// 3. Plugin and its internal structure Checks
else if (WsManURI.Contains(WSManStringLiterals.containerPlugin))
{
strPathCheck = strPathCheck + WSManStringLiterals.containerPlugin;
strPathCheck += WSManStringLiterals.containerPlugin;
// Check for Plugin path
XmlDocument xmlPlugins = FindResourceValue(sessionobj, WsManURI, null);
string currentpluginname = string.Empty;
Expand Down Expand Up @@ -477,7 +477,7 @@ WsMan Config Can be divided in to Four Fixed Regions to Check Whether it has Chi
ArrayList arrSecurities = null;
ArrayList arrResources = ProcessPluginResourceLevel(CurrentPluginXML, out arrSecurities);
ArrayList arrInitParams = ProcessPluginInitParamLevel(CurrentPluginXML);
strPathCheck = strPathCheck + WSManStringLiterals.DefaultPathSeparator;
strPathCheck += WSManStringLiterals.DefaultPathSeparator;
if (path.EndsWith(strPathCheck + WSManStringLiterals.containerResources, StringComparison.OrdinalIgnoreCase))
{
if (arrResources != null && arrResources.Count > 0)
Expand Down Expand Up @@ -1473,7 +1473,7 @@ WsMan Config Can be divided in to Four Fixed Regions to Check Whether Item is Co
strPathCheck = host + WSManStringLiterals.DefaultPathSeparator;
if (WsManURI.Contains(WSManStringLiterals.containerListener))
{
strPathCheck = strPathCheck + WSManStringLiterals.containerListener;
strPathCheck += WSManStringLiterals.containerListener;
if (path.EndsWith(strPathCheck, StringComparison.OrdinalIgnoreCase))
{
return true;
Expand All @@ -1494,7 +1494,7 @@ WsMan Config Can be divided in to Four Fixed Regions to Check Whether Item is Co
// 2. Client Certificate Checks
else if (WsManURI.Contains(WSManStringLiterals.containerCertMapping))
{
strPathCheck = strPathCheck + WSManStringLiterals.containerClientCertificate;
strPathCheck += WSManStringLiterals.containerClientCertificate;
if (path.EndsWith(strPathCheck, StringComparison.OrdinalIgnoreCase))
{
return true;
Expand All @@ -1514,19 +1514,19 @@ WsMan Config Can be divided in to Four Fixed Regions to Check Whether Item is Co
// 3. Plugin and its internal structure Checks
else if (WsManURI.Contains(WSManStringLiterals.containerPlugin))
{
strPathCheck = strPathCheck + WSManStringLiterals.containerPlugin;
strPathCheck += WSManStringLiterals.containerPlugin;
// Check for Plugin path
if (path.EndsWith(strPathCheck, StringComparison.OrdinalIgnoreCase))
{
return true;
}

strPathCheck = strPathCheck + WSManStringLiterals.DefaultPathSeparator;
strPathCheck += WSManStringLiterals.DefaultPathSeparator;
XmlDocument xmlPlugins = FindResourceValue(sessionobj, WsManURI, null);

string currentpluginname = string.Empty;
GetPluginNames(xmlPlugins, out objPluginNames, out currentpluginname, path);
strPathCheck = strPathCheck + currentpluginname;
strPathCheck += currentpluginname;
if (path.EndsWith(currentpluginname, StringComparison.OrdinalIgnoreCase))
{
return true;
Expand All @@ -1541,7 +1541,7 @@ WsMan Config Can be divided in to Four Fixed Regions to Check Whether Item is Co
return true;
}

strPathCheck = strPathCheck + WSManStringLiterals.DefaultPathSeparator;
strPathCheck += WSManStringLiterals.DefaultPathSeparator;
if (path.EndsWith(strPathCheck + WSManStringLiterals.containerResources, StringComparison.OrdinalIgnoreCase))
{
return true;
Expand Down Expand Up @@ -1695,7 +1695,7 @@ protected override void RemoveItem(string path, bool recurse)
return;
}

strPathCheck = strPathCheck + WSManStringLiterals.containerPlugin;
strPathCheck += WSManStringLiterals.containerPlugin;
int pos = 0; string pName = null;

pos = path.LastIndexOf(strPathCheck + WSManStringLiterals.DefaultPathSeparator, StringComparison.OrdinalIgnoreCase) + strPathCheck.Length + 1;
Expand Down Expand Up @@ -2152,7 +2152,7 @@ private void NewItemPluginOrPluginChild(object sessionobj, string path, string h
strPathChk = strPathChk + WSManStringLiterals.DefaultPathSeparator + pName + WSManStringLiterals.DefaultPathSeparator;
if (path.Contains(strPathChk + WSManStringLiterals.containerResources))
{
strPathChk = strPathChk + WSManStringLiterals.containerResources;
strPathChk += WSManStringLiterals.containerResources;
if (path.EndsWith(strPathChk, StringComparison.OrdinalIgnoreCase))
{
WSManProviderNewItemResourceParameters niParams = DynamicParameters as WSManProviderNewItemResourceParameters;
Expand Down Expand Up @@ -2768,7 +2768,7 @@ private XmlDocument EnumerateResourceValue(object sessionobj, string ResourceURI

while (!((IWSManEnumerator)value).AtEndOfStream)
{
strXmlValue = strXmlValue + ((IWSManEnumerator)value).ReadItem();
strXmlValue += ((IWSManEnumerator)value).ReadItem();
}

Marshal.ReleaseComObject(value);
Expand Down Expand Up @@ -2900,7 +2900,7 @@ private bool ContainResourceValue(object sessionobj, string ResourceURI, string

while (!((IWSManEnumerator)value).AtEndOfStream)
{
valuexml = valuexml + ((IWSManEnumerator)value).ReadItem();
valuexml += ((IWSManEnumerator)value).ReadItem();
}

if ((valuexml != string.Empty) && !(string.IsNullOrEmpty(valuexml)))
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.WSMan.Management/WSManInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ private string GetFilter()
filter = filter + "<wsman:Selector Name='" + name + "'>" + value + "</wsman:Selector>";
}

filter = filter + "</wsman:SelectorSet>";
filter += "</wsman:SelectorSet>";
return (filter);
}

Expand Down
32 changes: 16 additions & 16 deletions src/Microsoft.WSMan.Management/WsManHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ internal IWSManResourceLocator InitializeResourceLocator(Hashtable optionset, Ha

if (selectorset != null)
{
resource = resource + "?";
resource += "?";
int i = 0;
foreach (DictionaryEntry entry in selectorset)
{
Expand Down Expand Up @@ -656,7 +656,7 @@ internal IWSManSession CreateSessionObject(IWSManEx wsmanObject, AuthenticationM
{
if (authentication.Equals(AuthenticationMechanism.None))
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUseNoAuthentication;
sessionFlags |= (int)WSManSessionFlags.WSManFlagUseNoAuthentication;
}

if (authentication.Equals(AuthenticationMechanism.Basic))
Expand All @@ -666,12 +666,12 @@ internal IWSManSession CreateSessionObject(IWSManEx wsmanObject, AuthenticationM

if (authentication.Equals(AuthenticationMechanism.Negotiate))
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUseNegotiate;
sessionFlags |= (int)WSManSessionFlags.WSManFlagUseNegotiate;
}

if (authentication.Equals(AuthenticationMechanism.Kerberos))
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUseKerberos;
sessionFlags |= (int)WSManSessionFlags.WSManFlagUseKerberos;
}

if (authentication.Equals(AuthenticationMechanism.Digest))
Expand All @@ -686,7 +686,7 @@ internal IWSManSession CreateSessionObject(IWSManEx wsmanObject, AuthenticationM

if (authentication.Equals(AuthenticationMechanism.ClientCertificate))
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUseClientCertificate;
sessionFlags |= (int)WSManSessionFlags.WSManFlagUseClientCertificate;
}
}

Expand Down Expand Up @@ -718,15 +718,15 @@ internal IWSManSession CreateSessionObject(IWSManEx wsmanObject, AuthenticationM
connObject.Password = nwCredential.Password;
if (!authentication.Equals(AuthenticationMechanism.Credssp) || !authentication.Equals(AuthenticationMechanism.Digest) || authentication.Equals(AuthenticationMechanism.Basic))
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagCredUserNamePassword;
sessionFlags |= (int)WSManSessionFlags.WSManFlagCredUserNamePassword;
}
}
}

if (certificateThumbprint != null)
{
connObject.CertificateThumbprint = certificateThumbprint;
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUseClientCertificate;
sessionFlags |= (int)WSManSessionFlags.WSManFlagUseClientCertificate;
}

if (sessionoption != null)
Expand Down Expand Up @@ -784,48 +784,48 @@ internal IWSManSession CreateSessionObject(IWSManEx wsmanObject, AuthenticationM

if (sessionoption.SkipCACheck)
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagSkipCACheck;
sessionFlags |= (int)WSManSessionFlags.WSManFlagSkipCACheck;
}

if (sessionoption.SkipCNCheck)
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagSkipCNCheck;
sessionFlags |= (int)WSManSessionFlags.WSManFlagSkipCNCheck;
}

if (sessionoption.SPNPort > 0)
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagEnableSpnServerPort;
sessionFlags |= (int)WSManSessionFlags.WSManFlagEnableSpnServerPort;
}

if (sessionoption.UseUtf16)
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUtf16;
sessionFlags |= (int)WSManSessionFlags.WSManFlagUtf16;
}
else
{
// If UseUtf16 is false, then default Encoding is Utf8
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUtf8;
sessionFlags |= (int)WSManSessionFlags.WSManFlagUtf8;
}

if (!sessionoption.UseEncryption)
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagNoEncryption;
sessionFlags |= (int)WSManSessionFlags.WSManFlagNoEncryption;
}

if (sessionoption.SkipRevocationCheck)
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagSkipRevocationCheck;
sessionFlags |= (int)WSManSessionFlags.WSManFlagSkipRevocationCheck;
}
}
else
{
// If SessionOption is null then, default Encoding is Utf8
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUtf8;
sessionFlags |= (int)WSManSessionFlags.WSManFlagUtf8;
}

if (usessl)
{
sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUseSsl;
sessionFlags |= (int)WSManSessionFlags.WSManFlagUseSsl;
}

IWSManSession m_SessionObj = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4119,7 +4119,7 @@ private bool BindPipelineParameter(
/*argumentAst*/null, parameterValue,
false);

flags = flags & ~ParameterBindingFlags.DelayBindScriptBlock;
flags &= ~ParameterBindingFlags.DelayBindScriptBlock;
result = BindParameter(_currentParameterSetFlag, param, parameter, flags);

if (result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ internal static List<CompletionResult> PSv2GenerateMatchSetOfFiles(PowerShellExe

// Determine if we need to quote the paths we parse

lastWord = lastWord ?? string.Empty;
lastWord ??= string.Empty;
bool isLastWordEmpty = string.IsNullOrEmpty(lastWord);
bool lastCharIsStar = !isLastWordEmpty && lastWord.EndsWith('*');
bool containsGlobChars = WildcardPattern.ContainsWildcardCharacters(lastWord);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ private List<CompletionResult> GetResultForEnumPropertyValueOfDSCResource(
{
string completionText = isCursorInString ? value : stringQuote + value + stringQuote;
if (hasNewLine)
completionText = completionText + stringQuote;
completionText += stringQuote;
result.Add(new CompletionResult(
completionText,
value,
Expand Down Expand Up @@ -1494,7 +1494,7 @@ private List<CompletionResult> GetResultForEnumPropertyValueOfDSCResource(
{
string completionText = isCursorInString ? resource : stringQuote + resource + stringQuote;
if (hasNewLine)
completionText = completionText + stringQuote;
completionText += stringQuote;
result.Add(new CompletionResult(
completionText,
resource,
Expand Down
Loading