Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ internal static ErrorRecord InitializeErrorRecord(
ErrorRecord errorRecord = InitializeErrorRecordCore(
context,
exception: cimException,
errorId: cimException.MessageId ?? "MiClientApiError_" + cimException.NativeErrorCode,
errorId: cimException.MessageId ?? "MiClientApiError_" + cimException.NativeErrorCode.ToString(),
errorCategory: ConvertCimExceptionToErrorCategory(cimException),
cimResultContext: cimResultContext);

Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public uint ConnectToDataSource(StringCollection blgFileNames)
string doubleNullTerminated = string.Empty;
foreach (string fileName in blgFileNames)
{
doubleNullTerminated += fileName + '\0';
doubleNullTerminated += fileName + "\0";
}

doubleNullTerminated += '\0';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private void InitializeErrorRecord(CimJobContext jobContext, CimException cimExc
InitializeErrorRecordCore(
jobContext: jobContext,
exception: cimException,
errorId: cimException.MessageId ?? "MiClientApiError_" + cimException.NativeErrorCode,
errorId: cimException.MessageId ?? "MiClientApiError_" + cimException.NativeErrorCode.ToString(),
errorCategory: ConvertCimExceptionToErrorCategory(cimException));

if (cimException.ErrorData != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ private static IEnumerable<PortableExecutableReference> InitDefaultRefAssemblies
// We want to avoid reallocating the internal array, so we assert if the list capacity has increased.
Diagnostics.Assert(
defaultRefAssemblies.Capacity <= capacity,
$"defaultRefAssemblies was resized because of insufficient initial capacity! A capacity of {defaultRefAssemblies.Count} is required.");
$"defaultRefAssemblies was resized because of insufficient initial capacity! A capacity of {defaultRefAssemblies.Count.ToString()} is required.");

return defaultRefAssemblies;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private OrderByPropertyEntry MatchAndRemove(
for (int i = 0; i < list.Count; i++)
{
OrderByPropertyEntry listEntry = list[i];
Diagnostics.Assert(listEntry != null, "null listEntry " + i);
Diagnostics.Assert(listEntry != null, "null listEntry " + i.ToString());
if (0 == _comparer.Compare(match, listEntry))
{
list.RemoveAt(i);
Expand Down Expand Up @@ -335,7 +335,7 @@ private void Emit(OrderByPropertyEntry entry, string sideIndicator)
{
List<MshParameter> mshParameterList = _orderByProperty.MshParameterList;
Diagnostics.Assert(mshParameterList != null, "null mshParameterList");
Diagnostics.Assert(mshParameterList.Count == Property.Length, "mshParameterList.Count " + mshParameterList.Count);
Diagnostics.Assert(mshParameterList.Count == Property.Length, "mshParameterList.Count " + mshParameterList.Count.ToString());

for (int i = 0; i < Property.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ private string[] ConvertAccessControlListToStrings(CommonAcl acl, AccessRightTyp
{
StringBuilder aceString = new StringBuilder();
string ntAccount = ConvertToNTAccount(ace.SecurityIdentifier);
aceString.Append($"{ntAccount}: {ace.AceQualifier}");
aceString.Append($"{ntAccount}: {ace.AceQualifier.ToString()}");

if (ace.AceFlags != AceFlags.None)
{
aceString.Append($" {ace.AceFlags}");
aceString.Append($" {ace.AceFlags.ToString()}");
}

List<string> accessRightList = GetApplicableAccessRights(ace.AccessMask, typeName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1670,14 +1670,14 @@ private PSObject BuildMshobject(string type, IList<string> names, List<string> v
// if name is null and delimiter is '"', use a default property name 'UnspecifiedName'
if (name.Length == 0 && delimiterlocal == '"')
{
name = UnspecifiedName + unspecifiedNameIndex;
name = UnspecifiedName + unspecifiedNameIndex.ToString();
unspecifiedNameIndex++;
}

// if name is null and delimiter is not '"', use a default property name 'UnspecifiedName'
if (string.IsNullOrEmpty(name))
{
name = UnspecifiedName + unspecifiedNameIndex;
name = UnspecifiedName + unspecifiedNameIndex.ToString();
unspecifiedNameIndex++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ internal static string PlatformName
Regex pattern = new Regex(@"\d+(\.\d+)+");
string versionText = pattern.Match(OS).Value;
Version windowsPlatformversion = new Version(versionText);
s_windowsUserAgent = $"Windows NT {windowsPlatformversion.Major}.{windowsPlatformversion.Minor}";
s_windowsUserAgent = $"Windows NT {windowsPlatformversion.Major.ToString()}.{windowsPlatformversion.Minor.ToString()}";
}

return s_windowsUserAgent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ private static void CreateElevatedEntry(string title)
var hResult = CoCreateInstance(ref CLSID_DestinationList, null, CLSCTX_INPROC_SERVER, ref IID_IUnknown, out object pCustDestListobj);
if (hResult < 0)
{
Debug.Fail($"Creating ICustomDestinationList failed with HResult '{hResult}'.");
Debug.Fail($"Creating ICustomDestinationList failed with HResult '{hResult.ToString()}'.");
return;
}

var pCustDestList = (ICustomDestinationList)pCustDestListobj;
hResult = pCustDestList.BeginList(out uint uMaxSlots, new Guid(@"92CA9DCD-5622-4BBA-A805-5E9F541BD8C9"), out object pRemovedItems);
if (hResult < 0)
{
Debug.Fail($"BeginList on ICustomDestinationList failed with HResult '{hResult}'.");
Debug.Fail($"BeginList on ICustomDestinationList failed with HResult '{hResult.ToString()}'.");
return;
}

Expand All @@ -101,15 +101,15 @@ private static void CreateElevatedEntry(string title)
if (hResult < 0)
{
pCustDestList.AbortList();
Debug.Fail($"SetValue on IPropertyStore with title '{title}' failed with HResult '{hResult}'.");
Debug.Fail($"SetValue on IPropertyStore with title '{title}' failed with HResult '{hResult.ToString()}'.");
return;
}

hResult = nativePropertyStore.Commit();
if (hResult < 0)
{
pCustDestList.AbortList();
Debug.Fail($"Commit on IPropertyStore failed with HResult '{hResult}'.");
Debug.Fail($"Commit on IPropertyStore failed with HResult '{hResult.ToString()}'.");
return;
}

Expand All @@ -122,7 +122,7 @@ private static void CreateElevatedEntry(string title)
if (hResult < 0)
{
pCustDestList.AbortList();
Debug.Fail($"Creating IObjectCollection failed with HResult '{hResult}'.");
Debug.Fail($"Creating IObjectCollection failed with HResult '{hResult.ToString()}'.");
return;
}

Expand All @@ -134,7 +134,7 @@ private static void CreateElevatedEntry(string title)
if (hResult < 0)
{
pCustDestList.AbortList();
Debug.Fail($"AddUserTasks on ICustomDestinationList failed with HResult '{hResult}'.");
Debug.Fail($"AddUserTasks on ICustomDestinationList failed with HResult '{hResult.ToString()}'.");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ internal static int Start(string bannerText, string helpText, string[] args)

// put PSHOME in front of PATH so that calling `powershell` within `powershell` always starts the same running version
string path = Environment.GetEnvironmentVariable("PATH");
string pshome = Utils.DefaultPowerShellAppBase + Path.PathSeparator;
string pshome = Utils.DefaultPowerShellAppBase + Path.PathSeparator.ToString();

// to not impact startup perf, we don't remove duplicates, but we avoid adding a duplicate to the front
// we also don't handle the edge case where PATH only contains $PSHOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ private void WritePrintToken(
Dbg.Assert(!string.IsNullOrEmpty(printToken),
"Calling WritePrintToken with printToken being null or empty");
Dbg.Assert(printToken.Length == 1,
"Calling WritePrintToken with printToken's Length being " + printToken.Length);
"Calling WritePrintToken with printToken's Length being " + printToken.Length.ToString());
Size consoleBufferSize = _rawui.BufferSize;
Coordinates currentCursorPosition = _rawui.CursorPosition;

Expand Down Expand Up @@ -1677,7 +1677,7 @@ private string ReadLineFromConsole(bool endOnTab, string initialContent, bool ca
Write(StringUtil.Padding(leftover));
RawUI.CursorPosition = c;

restOfLine = s[i] + (charUnderCursor + s.Substring(i + 1));
restOfLine = s[i].ToString() + (charUnderCursor.ToString() + s.Substring(i + 1));
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public class VT100EscapeSequences
{
private const char Esc = (char)0x1B;

private string endSequence = Esc + "[0m";
private string endSequence = Esc.ToString() + "[0m";

// For code blocks, [500@ make sure that the whole line has background color.
private const string LongBackgroundCodeBlock = "[500@";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1441,12 +1441,12 @@ private static string EnsureDriveIsRooted(string path)
// the root path separator back
if (index + 1 == path.Length)
{
result = path + StringLiterals.DefaultPathSeparator;
result = path + StringLiterals.DefaultPathSeparator.ToString();
}
}
else if ((path.Length == 0) || (path[0] != StringLiterals.DefaultPathSeparator))
{
result = StringLiterals.DefaultPathSeparator + path;
result = StringLiterals.DefaultPathSeparator.ToString() + path;
}

s_tracer.WriteLine("result = {0}", result);
Expand Down
Loading