Skip to content

Commit

Permalink
Fix #1512: XmlDocumentationProvider Unable to load some XML files to …
Browse files Browse the repository at this point in the history
…have special characters
  • Loading branch information
siegfriedpammer committed Mar 12, 2021
1 parent 7e913e0 commit ba5d23a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ sealed class LinePositionMapper
char prevChar = '\0';

// buffers for use with Decoder:
byte[] input = new byte[1];
char[] output = new char[1];
readonly byte[] input = new byte[1];
readonly char[] output = new char[2];

public LinePositionMapper(FileStream fs, Encoding encoding)
{
Expand All @@ -289,7 +289,7 @@ public int GetPositionForLine(int line)
if (b < 0)
throw new EndOfStreamException();
input[0] = (byte)b;
decoder.Convert(input, 0, 1, output, 0, 1, false, out int bytesUsed, out int charsUsed, out _);
decoder.Convert(input, 0, 1, output, 0, output.Length, false, out int bytesUsed, out int charsUsed, out _);
Debug.Assert(bytesUsed == 1);
if (charsUsed == 1)
{
Expand Down

0 comments on commit ba5d23a

Please sign in to comment.