Browse Source

Fix performance of AddXmlDocumentationTransform

pull/850/head
Siegfried Pammer 8 years ago
parent
commit
d51d21513d
  1. 14
      ICSharpCode.Decompiler/CSharp/Transforms/AddXmlDocumentationTransform.cs
  2. 1
      ICSharpCode.Decompiler/Documentation/XmlDocLoader.cs

14
ICSharpCode.Decompiler/CSharp/Transforms/AddXmlDocumentationTransform.cs

@ -34,6 +34,9 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -34,6 +34,9 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
{
if (!context.Settings.ShowXmlDocumentation)
return;
var xmldoc = XmlDocLoader.LoadDocumentation(context.TypeSystem.ModuleDefinition);
if (xmldoc == null)
return;
foreach (var entity in rootNode.DescendantsAndSelf.OfType<EntityDeclaration>()) {
var symbol = entity.GetSymbol();
Mono.Cecil.MemberReference mr;
@ -47,14 +50,9 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -47,14 +50,9 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
default:
continue;
}
if (mr != null && mr.Module != null) {
var xmldoc = XmlDocLoader.LoadDocumentation(mr.Module);
if (xmldoc != null) {
string doc = xmldoc.GetDocumentation(XmlDocKeyProvider.GetKey(mr));
if (doc != null) {
InsertXmlDocumentation(entity, new StringReader(doc));
}
}
string doc = xmldoc.GetDocumentation(XmlDocKeyProvider.GetKey(mr));
if (doc != null) {
InsertXmlDocumentation(entity, new StringReader(doc));
}
}
}

1
ICSharpCode.Decompiler/Documentation/XmlDocLoader.cs

@ -62,6 +62,7 @@ namespace ICSharpCode.Decompiler.Documentation @@ -62,6 +62,7 @@ namespace ICSharpCode.Decompiler.Documentation
xmlDoc = new XmlDocumentationProvider(xmlDocFile);
cache.Add(module, xmlDoc);
} else {
cache.Add(module, null); // add missing documentation files as well
xmlDoc = null;
}
}

Loading…
Cancel
Save