private void InvalidCharRecovery(ref int bytesCount, out int charsCount)
{
int charsDecoded = 0;
int bytesDecoded = 0;
try
{
while (bytesDecoded < bytesCount)
{
int chDec;
int bDec;
bool completed;
_ps.decoder.Convert(_ps.bytes, _ps.bytePos + bytesDecoded, 1, _ps.chars, _ps.charsUsed + charsDecoded, 1, false, out bDec, out chDec, out completed);
charsDecoded += chDec;
bytesDecoded += bDec;
}
Debug.Assert(false, "We should get an exception again.");
}
catch (ArgumentException)
{
}
if (charsDecoded == 0)
{
Throw(_ps.charsUsed, SR.Xml_InvalidCharInThisEncoding);
}
charsCount = charsDecoded;
bytesCount = bytesDecoded;
}