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:
authorJoel Martinez <joelmartinez@gmail.com>2018-06-19 00:18:05 +0300
committerJoel Martinez <joelmartinez@gmail.com>2018-06-19 00:33:21 +0300
commit8c6cdc8a4d04fa0a68b8404611b08731c93293c5 (patch)
tree801b9165c2d264ceb4be665af915bab6a6a0904d
parent00775ff1a51447ca0bd888924e01ca06d034e412 (diff)
Improved NRE guards in formatters.
Resolves #267
-rw-r--r--mdoc/Mono.Documentation/Updater/Formatters/FSharpFormatter.cs4
-rw-r--r--mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs8
2 files changed, 10 insertions, 2 deletions
diff --git a/mdoc/Mono.Documentation/Updater/Formatters/FSharpFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/FSharpFormatter.cs
index 75155d61..0ab66627 100644
--- a/mdoc/Mono.Documentation/Updater/Formatters/FSharpFormatter.cs
+++ b/mdoc/Mono.Documentation/Updater/Formatters/FSharpFormatter.cs
@@ -228,9 +228,11 @@ namespace Mono.Documentation.Updater
foreach (var interfaceImplementation in type.Interfaces)
{
+ var resolvedInterface = interfaceImplementation.InterfaceType.Resolve ();
+
if (type.IsValueType
&& ignoredValueTypeInterfaces.Any(i => interfaceImplementation.InterfaceType.FullName.StartsWith(i))
- || interfaceImplementation.InterfaceType.Resolve().IsNotPublic)
+ || (resolvedInterface != null && resolvedInterface.IsNotPublic))
continue;
buf.Append($"{GetLineEnding()}{Consts.Tab}interface ");
AppendTypeName(buf, GetTypeName(interfaceImplementation.InterfaceType));
diff --git a/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs
index 14a2ddfe..b0e70667 100644
--- a/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs
+++ b/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs
@@ -106,6 +106,9 @@ namespace Mono.Documentation.Updater
protected StringBuilder _AppendTypeName (StringBuilder buf, TypeReference type, DynamicParserContext context, bool appendGeneric = true)
{
+ if (type == null)
+ return buf;
+
if (type is ArrayType)
{
return AppendArrayTypeName(buf, type, context);
@@ -129,7 +132,9 @@ namespace Mono.Documentation.Updater
{
try
{
- type = type.Resolve();
+ var rtype = type.Resolve ();
+ if (rtype != null)
+ type = rtype;
}
catch (Exception)
{
@@ -138,6 +143,7 @@ namespace Mono.Documentation.Updater
}
}
+
if (type.GenericParameters.Count == 0 &&
(genInst == null ? true : genInst.GenericArguments.Count == 0))
{