CSharpDecompiler reads the XML documentation file with ShowXmlDocumentation off
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
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
- Put an assembly with its XML documentation file beside it, for example Newtonsoft.Json 13.0.4 (netstandard2.0):
Newtonsoft.Json.dllplus the 732 KBNewtonsoft.Json.xml. - Hold the
.xmlopen withFileShare.None. - 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:
CreateDecompileRunsetsDocumentationProvider = DocumentationProvider ?? CreateDefaultDocumentationProvider()regardless ofsettings.ShowXmlDocumentation, andCreateDefaultDocumentationProvidercatches onlyXmlException, so anIOExceptionorUnauthorizedAccessExceptionfails the decompile. - A possible fix: create the default provider only when
settings.ShowXmlDocumentationis set, and treat an unreadable file like a missing one. As a workaround we setCSharpDecompiler.DocumentationProviderto 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
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from icsharpcode/ILSpy
-
External UI
Difficulty 1/5 1-3 hours Newbie friendliness 75/100
icsharpcode/ILSpy#4284 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 3/5 1-2 days Newbie friendliness 67/100
icsharpcode/ILSpy#4295 ·
Maintainers usually reply within 1 day
-
Bug Decompiler
Difficulty 4/5 3-5 days Newbie friendliness 52/100
icsharpcode/ILSpy#4280 · 1 comment ·
Maintainers usually reply within 1 day
-
Bug Decompiler
Difficulty 3/5 1-2 days Newbie friendliness 66/100
icsharpcode/ILSpy#4279 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
icsharpcode/ILSpy#4272 · 1 comment ·
Maintainers usually reply within 1 day
All issues in icsharpcode/ILSpy
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Open-Systems-Pharmacology/OSPSuite.Core#3049 ·
Maintainers usually reply within 1 day
-
needs attention public-client untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
AzureAD/microsoft-authentication-library-for-dotnet#6242 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
criticalmanufacturing/cli#882 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Dome-Works/DOME#129 ·
Maintainers usually reply within 1 day
-
bug sev:L
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Systemorph/MeshWeaver#7480 ·
Maintainers usually reply within 1 day