Skip to content

Commit bcc86a8

Browse files
authored
Fix 715817: ignore private attribute (#659)
* Fix 715817: ignore private attribute * update * update * update
1 parent 75d6c3d commit bcc86a8

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeFormatter.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,23 @@ private bool IsIgnoredAttribute(CustomAttribute customAttribute)
138138
return false;
139139
}
140140

141-
var attrTypeDef = attrType as TypeDefinition;
142-
if (attrTypeDef != null && !DocUtils.IsPublic(attrTypeDef) || (FormatterManager.SlashdocFormatter.GetName(attrType) == null)
141+
if (FormatterManager.SlashdocFormatter.GetName(attrType) == null
143142
|| Array.IndexOf(IgnorableAttributes, attrType.FullName) >= 0)
144143
{
145144
return true;
146145
}
147146

148-
return false;
147+
try
148+
{
149+
var attrTypeDef = attrType.Resolve();
150+
// We probably should return true if attrTypeDef is null, but it would cause too many diffs in dotnet-api-docs repo.
151+
return attrTypeDef != null && !DocUtils.IsPublic(attrTypeDef);
152+
}
153+
catch (Exception ex)
154+
{
155+
Console.WriteLine($"Unable to resolve {attrType.FullName}", ex);
156+
return true;
157+
}
149158
}
150159

151160
// FIXME: get TypeReferences instead of string comparison?

0 commit comments

Comments
 (0)