Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XmlDocumentationProvider Unable to load some XML files to have special characters #1512

Closed
maikebing opened this issue May 13, 2019 · 4 comments
Labels
Bug Decompiler The decompiler engine itself
Milestone

Comments

@maikebing
Copy link
Contributor

maikebing commented May 13, 2019

bug2

Polls.zip

var xmlDoc = new XmlDocumentationProvider(@"Polls.xml");

The output character buffer is too small to contain decoded characters, and the operation "Unicode" encoding "UTF-8" returns "System.Text.DecoderExceptionFallback". Parameter name: chars

at System.Text.Encoding.ThrowCharsOverflow()
at System.Text.Encoding.ThrowCharsOverflow(DecoderNLS decoder, Boolean nothingDecoded)
at System.Text.UTF8Encoding.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, DecoderNLS baseDecoder)
at System.Text.DecoderNLS.Convert(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, Boolean flush, Int32& bytesUsed, Int32& charsUsed, Boolean& completed)
at System.Text.DecoderNLS.Convert(Byte[] bytes, Int32 byteIndex, Int32 byteCount, Char[] chars, Int32 charIndex, Int32 charCount, Boolean flush, Int32& bytesUsed, Int32& charsUsed, Boolean& completed)
at ICSharpCode.Decompiler.Documentation.XmlDocumentationProvider.LinePositionMapper.GetPositionForLine(Int32 line)
at ICSharpCode.Decompiler.Documentation.XmlDocumentationProvider.ReadMembersSection(XmlTextReader reader, LinePositionMapper linePosMapper, List`1 indexList)
at ICSharpCode.Decompiler.Documentation.XmlDocumentationProvider.ReadXmlDoc(XmlTextReader reader)
at ICSharpCode.Decompiler.Documentation.XmlDocumentationProvider..ctor(String fileName)

@maikebing
Copy link
Contributor Author

bug

@maikebing
Copy link
Contributor Author

I wrote the following code, but I don't get an error, I don't know exactly what caused it.

 byte[] input = new byte[] { 172 };
            char[] output = new char[] { (char)32};
            int bytesUsed=1, charsUsed=0;
            bool completed;
            System.Text.UTF8Encoding.UTF32.GetDecoder().Convert(input, 0, 1, output, 0, 1, false, out bytesUsed, out charsUsed, out completed);

@siegfriedpammer siegfriedpammer added Bug Decompiler The decompiler engine itself labels Jul 14, 2019
@siegfriedpammer
Copy link
Member

@dgrunwald I spent some time analyzing this today and it seems that the decoder gets confused by some emoji. I would suggest just catching the exception and skipping over it. What do you think?

@wiz0u
Copy link

wiz0u commented Mar 11, 2021

I experienced this issue with the Telegram.Bot nuget package as well

@siegfriedpammer siegfriedpammer added this to the v7.0-rc milestone Mar 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Decompiler The decompiler engine itself
Projects
None yet
Development

No branches or pull requests

3 participants