From 1329231bf2bd1371b1bbf21ae7fe0def087e1722 Mon Sep 17 00:00:00 2001 From: Laszlo Paillat Date: Sun, 23 Feb 2020 17:17:50 +0100 Subject: [PATCH] fixed NullReferenceException for generic type fixed internal interfaces shown in implementation release 0.5.5 --- .../DefaultDocumentation/DefaultDocumentation.Release.csproj | 5 ++++- source/DefaultDocumentation/DocumentationWriter.cs | 3 ++- source/DefaultDocumentation/Model/TypeDocItem.cs | 2 +- source/DefaultDocumentation/Properties/launchSettings.json | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/DefaultDocumentation/DefaultDocumentation.Release.csproj b/source/DefaultDocumentation/DefaultDocumentation.Release.csproj index 3b5fd257..8e37f53a 100644 --- a/source/DefaultDocumentation/DefaultDocumentation.Release.csproj +++ b/source/DefaultDocumentation/DefaultDocumentation.Release.csproj @@ -7,9 +7,12 @@ - 0.5.4 + 0.5.5 +fixed TypeDocItem writing members of nested types fixed nested type not showing parent type in name +fixed NullReferenceException for generic type +fixed internal interfaces shown in implementation \ No newline at end of file diff --git a/source/DefaultDocumentation/DocumentationWriter.cs b/source/DefaultDocumentation/DocumentationWriter.cs index 1bdaa0aa..41db4925 100644 --- a/source/DefaultDocumentation/DocumentationWriter.cs +++ b/source/DefaultDocumentation/DocumentationWriter.cs @@ -75,7 +75,8 @@ public string GetTypeLink(DocItem item, IType type) { string HandleParameterizedType(ParameterizedType genericType) { - if (_items.TryGetValue(genericType.GetDefinition().GetIdString(), out DocItem docItem) && docItem is TypeDocItem typeDocItem) + ITypeDefinition typeDefinition = genericType.GetDefinition(); + if (typeDefinition != null && _items.TryGetValue(typeDefinition.GetIdString(), out DocItem docItem) && docItem is TypeDocItem typeDocItem) { return GetLink(docItem, typeDocItem.Type.FullName + "<") + string.Join(GetLink(docItem, ","), genericType.TypeArguments.Select(t => GetTypeLink(item, t))) diff --git a/source/DefaultDocumentation/Model/TypeDocItem.cs b/source/DefaultDocumentation/Model/TypeDocItem.cs index 4787cff4..a4621de5 100644 --- a/source/DefaultDocumentation/Model/TypeDocItem.cs +++ b/source/DefaultDocumentation/Model/TypeDocItem.cs @@ -44,7 +44,7 @@ public override void WriteDocumentation(DocumentationWriter writer) writer.Write(this, Documentation.GetSummary()); - List interfaces = Type.DirectBaseTypes.Where(t => t.Kind == TypeKind.Interface).ToList(); + List interfaces = Type.DirectBaseTypes.Where(t => t.Kind == TypeKind.Interface && t.GetDefinition().Accessibility == Accessibility.Public).ToList(); writer.WriteLine("```csharp"); writer.Write(CodeAmbience.ConvertSymbol(Type)); diff --git a/source/DefaultDocumentation/Properties/launchSettings.json b/source/DefaultDocumentation/Properties/launchSettings.json index b899fb9d..2184af9a 100644 --- a/source/DefaultDocumentation/Properties/launchSettings.json +++ b/source/DefaultDocumentation/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "DefaultDocumentation": { "commandName": "Project", - "commandLineArgs": "/assembly:\"D:\\Projects\\DefaultEcs\\source\\DefaultEcs\\bin\\Release\\netstandard2.0\\DefaultEcs.dll\" /xml:\"D:\\Projects\\DefaultEcs\\source\\DefaultEcs\\bin\\Release\\netstandard2.0\\DefaultEcs.xml\" /output:\"D:\\Projects\\DefaultEcs\\documentation\\api\"" + "commandLineArgs": "/assembly:\"D:\\Projects\\DefaultEcs\\source\\DefaultEcs\\bin\\Release\\netstandard2.1\\DefaultEcs.dll\" /xml:\"D:\\Projects\\DefaultEcs\\source\\DefaultEcs\\obj\\Release\\netstandard2.1\\DefaultEcs.xml\" /output:\"D:\\Projects\\DefaultEcs\\documentation\\api\" /home:\"\" /baselink:\"\" /linksfile:\"\"" } } } \ No newline at end of file