Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

CSharpDecompiler reads the XML documentation file with ShowXmlDocumentation off

Open Beginner friendly
#4,275 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
devtools

Research direction

Start in CSharpDecompiler.cs around CreateDecompileRun and CreateDefaultDocumentationProvider, which the issue identifies as the source. Check how ShowXmlDocumentation controls provider creation and how unreadable XML files are handled. Reproduce with the locked XML file and ShowXmlDocumentation disabled; done means decompilation succeeds without opening or parsing the documentation file.

Written by the indexing model from the issue text.

Description

Steps to reproduce
  1. Put an assembly with its XML documentation file beside it, for example Newtonsoft.Json 13.0.4 (netstandard2.0): Newtonsoft.Json.dll plus the 732 KB Newtonsoft.Json.xml.
  2. Hold the .xml open with FileShare.None.
  3. Decompile a type with ShowXmlDocumentation = false:
var dll = args[0];
var xml = Path.ChangeExtension(dll, ".xml");
using (new FileStream(xml, FileMode.Open, FileAccess.Read, FileShare.None))
    Console.WriteLine(new CSharpDecompiler(dll, new DecompilerSettings { ShowXmlDocumentation = false })
        .DecompileTypeAsString(new FullTypeName(args[1])).Length);

Run it with the dll path and Newtonsoft.Json.JsonConvert.

Error message shown
System.IO.IOException: The process cannot access the file '...\Newtonsoft.Json.xml' because it is being used by another process.

Expected: with ShowXmlDocumentation off, the documentation file is not opened and the type decompiles.

Without the lock the decompile succeeds, but every decompiler instance still parses the whole documentation file although nothing uses it. In a fresh process that is about 10-15% of the CPU of a first decompile of a large type.

Details
  • Product in use: ICSharpCode.Decompiler nuget package
  • Version in use: 11.1.0.9782; master has the same code (CSharpDecompiler.cs, line 894). .NET 10, Windows 11 x64.
  • Cause as read from source: CreateDecompileRun sets DocumentationProvider = DocumentationProvider ?? CreateDefaultDocumentationProvider() regardless of settings.ShowXmlDocumentation, and CreateDefaultDocumentationProvider catches only XmlException, so an IOException or UnauthorizedAccessException fails the decompile.
  • A possible fix: create the default provider only when settings.ShowXmlDocumentation is set, and treat an unreadable file like a missing one. As a workaround we set CSharpDecompiler.DocumentationProvider to a provider that returns null.
Dominant language
C#
Stars
26.8k
Forks
3.8k
Avg merge
1d 3h
Merged PRs (30d)
72

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from icsharpcode/ILSpy

All issues in icsharpcode/ILSpy

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.