Use interpolated strings in more places

This commit is contained in:
Stephen Toub committed 2021-07-13 10:11:51 -04:00
1 parent 1446bdb776
commit dfd618dc64
254 files changed
+671 -979

No files matched your search

@@ -337,7 +337,7 @@ namespace System.Text
if (pCodePageIndex->CodePage == codePage)
{
Debug.Assert(pCodePageIndex->ByteCount == 1 || pCodePageIndex->ByteCount == 2,
"[BaseCodePageEncoding] Code page (" + codePage + ") has invalid byte size (" + pCodePageIndex->ByteCount + ") in table");
$"[BaseCodePageEncoding] Code page ({codePage}) has invalid byte size ({pCodePageIndex->ByteCount}) in table");
// Return what it says for byte count
return pCodePageIndex->ByteCount;
}
@@ -399,7 +399,7 @@ namespace System.Text
if (bOutOfOrder)
{
Debug.Assert((arrayTemp.Length / 2) < 20,
"[DBCSCodePageEncoding.ReadBestFitTable]Expected small best fit table < 20 for code page " + CodePage + ", not " + arrayTemp.Length / 2);
$"[DBCSCodePageEncoding.ReadBestFitTable]Expected small best fit table < 20 for code page {CodePage}, not {arrayTemp.Length / 2}");
for (int i = 0; i < arrayTemp.Length - 2; i += 2)
{
@@ -84,7 +84,7 @@ namespace System.Text
// If we had a buffer already we're being recursive, throw, it's probably at the suspect
// character in our array.
// Shouldn't be able to get here for all of our code pages, table would have to be messed up.
Debug.Assert(_iCount < 1, "[InternalEncoderBestFitFallbackBuffer.Fallback(non surrogate)] Fallback char " + ((int)_cBestFit).ToString("X4", CultureInfo.InvariantCulture) + " caused recursive fallback");
Debug.Assert(_iCount < 1, $"[InternalEncoderBestFitFallbackBuffer.Fallback(non surrogate)] Fallback char {(int)_cBestFit:X4} caused recursive fallback");
_iCount = _iSize = 1;
_cBestFit = TryBestFit(charUnknown);
@@ -106,7 +106,7 @@ namespace System.Text
// If we had a buffer already we're being recursive, throw, it's probably at the suspect
// character in our array. 0 is processing last character, < 0 is not falling back
// Shouldn't be able to get here, table would have to be messed up.
Debug.Assert(_iCount < 1, "[InternalEncoderBestFitFallbackBuffer.Fallback(surrogate)] Fallback char " + ((int)_cBestFit).ToString("X4", CultureInfo.InvariantCulture) + " caused recursive fallback");
Debug.Assert(_iCount < 1, $"[InternalEncoderBestFitFallbackBuffer.Fallback(surrogate)] Fallback char {(int)_cBestFit:X4} caused recursive fallback");
// Go ahead and get our fallback, surrogates don't have best fit
_cBestFit = '?';
@@ -188,7 +188,7 @@ namespace System.Text
// We should've read in GBLast4ByteCode 4 byte sequences
Debug.Assert(count4Byte == GBLast4ByteCode + 1,
"[GB18030Encoding.LoadManagedCodePage] Expected 0x99FB to be last 4 byte offset, found 0x" + count4Byte.ToString("X4", CultureInfo.InvariantCulture));
$"[GB18030Encoding.LoadManagedCodePage] Expected 0x99FB to be last 4 byte offset, found 0x{count4Byte:X4}");
}
// Is4Byte
@@ -242,7 +242,7 @@ namespace System.Text
if (charLeftOver != 0)
{
Debug.Assert(char.IsHighSurrogate(charLeftOver),
"[GB18030Encoding.GetBytes] leftover character should be high surrogate, not 0x" + ((int)charLeftOver).ToString("X4", CultureInfo.InvariantCulture));
$"[GB18030Encoding.GetBytes] leftover character should be high surrogate, not 0x{(int)charLeftOver:X4}");
// If our next char isn't a low surrogate, then we need to do fallback.
if (!char.IsLowSurrogate(ch))
@@ -272,7 +272,7 @@ namespace System.Text
byte byte2 = (byte)((offset % 0x0a) + 0x30);
offset /= 0x0a;
Debug.Assert(offset < 0x6f,
"[GB18030Encoding.GetBytes](1) Expected offset < 0x6f, not 0x" + offset.ToString("X2", CultureInfo.InvariantCulture));
$"[GB18030Encoding.GetBytes](1) Expected offset < 0x6f, not 0x{offset:X2}");
charLeftOver = (char)0;
if (!buffer.AddByte((byte)(offset + 0x90), byte2, byte3, byte4))
@@ -322,7 +322,7 @@ namespace System.Text
byte byte2 = (byte)((iBytes % 0x0a) + 0x30);
iBytes /= 0x0a;
Debug.Assert(iBytes < 0x7e,
"[GB18030Encoding.GetBytes]Expected iBytes < 0x7e, not 0x" + iBytes.ToString("X2", CultureInfo.InvariantCulture));
$"[GB18030Encoding.GetBytes]Expected iBytes < 0x7e, not 0x{iBytes:X2}");
if (!buffer.AddByte((byte)(iBytes + 0x81), byte2, byte3, byte4))
break;
}
@@ -58,7 +58,7 @@ namespace System.Text
// Legal windows code pages are between Devanagari and Punjabi
Debug.Assert(_defaultCodePage >= CodeDevanagari && _defaultCodePage <= CodePunjabi,
"[ISCIIEncoding] Code page (" + codePage + " isn't supported by ISCIIEncoding!");
$"[ISCIIEncoding] Code page ({codePage} isn't supported by ISCIIEncoding!");
// This shouldn't really be possible
if (_defaultCodePage < CodeDevanagari || _defaultCodePage > CodePunjabi)
@@ -237,7 +237,7 @@ namespace System.Text
// We only know how to map from Unicode to pages from Devanagari to Punjabi (2 to 11)
Debug.Assert(currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi,
"[ISCIIEncoding.GetBytes]Code page (" + currentCodePage + " shouldn't appear in ISCII from Unicode table!");
$"[ISCIIEncoding.GetBytes]Code page ({currentCodePage} shouldn't appear in ISCII from Unicode table!");
}
// Safe to add our byte now
@@ -252,7 +252,7 @@ namespace System.Text
{
// This one needs another byte
Debug.Assert((indicTwoBytes >> 12) > 0 && (indicTwoBytes >> 12) <= 3,
"[ISCIIEncoding.GetBytes]Expected indicTwoBytes from 1-3, not " + (indicTwoBytes >> 12));
$"[ISCIIEncoding.GetBytes]Expected indicTwoBytes from 1-3, not {(indicTwoBytes >> 12)}");
// Already did buffer checking, but...
if (!buffer.AddByte(s_SecondIndicByte[indicTwoBytes >> 12]))
@@ -350,7 +350,7 @@ namespace System.Text
// Get our current code page index (some code pages are dups)
int currentCodePageIndex = -1;
Debug.Assert(currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi,
"[ISCIIEncoding.GetChars]Decoder code page must be >= Devanagari and <= Punjabi, not " + currentCodePage);
$"[ISCIIEncoding.GetChars]Decoder code page must be >= Devanagari and <= Punjabi, not {currentCodePage}");
if (currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi)
{