public bool HasNestedClassesDuplicateNames(TypeReference tref) { string inputName = DocUtils.GetFormattedTypeName(tref.Name); TypeDefinition parentType; try { parentType = tref.DeclaringType?.Resolve(); } catch { //Resolve() can fail as sometimes Cecil understands types as .net //needs to ignore those errors parentType = null; } if (parentType != null && parentType.HasNestedTypes) { var listOfNested = parentType.NestedTypes; int count = listOfNested.Select(x => DocUtils.GetFormattedTypeName(x.Name)).Count(y => y == inputName); if (count > 1) { return(true); } } return(false); }