Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Pryor <jonpryor@vt.edu>2014-05-15 00:04:05 +0400
committerDuncan Mak <duncanm@microsoft.com>2016-10-08 03:30:34 +0300
commit712445f69ea8af8d07a58e05608e0ef1d4d53251 (patch)
tree020a9e6d5e6aaa731ec4fb04b1d84a1d3f10bd8c /mdoc/Test/DocTest-v1.cs
parent0743f32d4b9cd7010eec3a1234fcd13cab6185a3 (diff)
[mdoc] Fix NullReferenceException when importing @name attribute.
(Reported by directhex on #mono 2014-05-14 at 14:28 EDT.) When importing Microsoft XML Documentation, if a //altmember/@name, //exception/@name, or //permission/@name attribute is encountered then mdoc will die with a NullReferenceException: mdoc: System.NullReferenceException: Object reference not set to an instance of an object at Mono.Documentation.MsxdocDocumentationImporter.ImportDocumentation (Mono.Documentation.DocsNodeInfo info) at Mono.Documentation.MDocUpdater.MakeDocNode (Mono.Documentation.DocsNodeInfo info) at Mono.Documentation.MDocUpdater.UpdateMember (Mono.Documentation.DocsNodeInfo info) at Mono.Documentation.MDocUpdater.MakeMember (System.Xml.XmlDocument doc, Mono.Documentation.DocsNodeInfo info) at Mono.Documentation.MDocUpdater.DoUpdateType2 (System.String message, System.Xml.XmlDocument basefile, Mono.Cecil.TypeDefinition type, System.String output, Boolean insertSince) at Mono.Documentation.MDocUpdater.StubType (Mono.Cecil.TypeDefinition type, System.String output) at Mono.Documentation.MDocUpdater.DoUpdateType (Mono.Cecil.TypeDefinition type, System.String basepath, System.String dest) at Mono.Documentation.MDocUpdater.DoUpdateAssembly (Mono.Cecil.AssemblyDefinition assembly, System.Xml.XmlElement index_types, System.String source, System.String dest, System.Collections.Generic.HashSet`1 goodfiles) at Mono.Documentation.MDocUpdater.DoUpdateAssemblies (System.String source, System.String dest) at Mono.Documentation.MDocUpdater.Run (IEnumerable`1 args) at Mono.Documentation.MDoc.Run (System.String[] args) at Mono.Documentation.MDoc.Main (System.String[] args) The cause of the NullReferenceException is due to inconsistent checking: we check that _either_ `child.Attributes["cref"]` OR `child.Attributes["name"]` is not null, and if one of them IS non-null then we just grab `child.Attributes["cref"].Value`, which will throw a NullReferenceException if the @name attribute was present but not the @cref attribute. The fix is to be consistent: once we grab an XmlAttribute, use the already looked up XmlAttribute, don't re-look it up.
Diffstat (limited to 'mdoc/Test/DocTest-v1.cs')
-rw-r--r--mdoc/Test/DocTest-v1.cs1
1 files changed, 1 insertions, 0 deletions
diff --git a/mdoc/Test/DocTest-v1.cs b/mdoc/Test/DocTest-v1.cs
index 52bc1961..4e064b42 100644
--- a/mdoc/Test/DocTest-v1.cs
+++ b/mdoc/Test/DocTest-v1.cs
@@ -438,6 +438,7 @@ namespace Mono.DocTest {
/// <para><c>M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})</c>.</para>
/// <para><see cref="M:System.Collections.Generic.List{System.Int32}.Remove(`0)" /></para>
/// </remarks>
+ /// <exception name="Whatever">text!</exception>
/// <exception invalid="foo">text!</exception>
public void Process (List<int> list)
{