Browse Source

Add XmlException handling to AddXmlDocumentationTransform

pull/850/head
Siegfried Pammer 8 years ago
parent
commit
ae01bfabb4
  1. 8
      ICSharpCode.Decompiler/CSharp/Transforms/AddXmlDocumentationTransform.cs

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

@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
using System;
using System.IO;
using System.Linq;
using System.Xml;
using ICSharpCode.Decompiler.CSharp.Syntax;
using ICSharpCode.Decompiler.Documentation;
using ICSharpCode.Decompiler.TypeSystem;
@ -34,6 +35,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -34,6 +35,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
{
if (!context.Settings.ShowXmlDocumentation)
return;
try {
var xmldoc = XmlDocLoader.LoadDocumentation(context.TypeSystem.ModuleDefinition);
if (xmldoc == null)
return;
@ -55,6 +57,12 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -55,6 +57,12 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
InsertXmlDocumentation(entity, new StringReader(doc));
}
}
} catch (XmlException ex) {
string[] msg = (" Exception while reading XmlDoc: " + ex.ToString()).Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
var insertionPoint = rootNode.FirstChild;
for (int i = 0; i < msg.Length; i++)
rootNode.InsertChildBefore(insertionPoint, new Comment(msg[i], CommentType.Documentation), Roles.Comment);
}
}
static void InsertXmlDocumentation(AstNode node, StringReader r)

Loading…
Cancel
Save