From ba5d23a835e708d6f9c843a21edb41963828c88f Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 12 Mar 2021 21:03:10 +0100 Subject: [PATCH] Fix #1512: XmlDocumentationProvider Unable to load some XML files to have special characters --- .../Documentation/XmlDocumentationProvider.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs b/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs index b28d2f6ef..1f0b2da72 100644 --- a/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs +++ b/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs @@ -271,8 +271,8 @@ namespace ICSharpCode.Decompiler.Documentation 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) { @@ -289,7 +289,7 @@ namespace ICSharpCode.Decompiler.Documentation 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) {