@@ -122,12 +122,12 @@ private static bool IsAttachedProperty(FieldDefinition field, Dictionary<string,
122122 // https://github.com/mono/api-doc-tools/issues/63#issuecomment-328995418
123123 if ( ! field . Name . EndsWith ( PropertyConst , StringComparison . Ordinal ) )
124124 return false ;
125- var propertyName = GetPropertyName ( field . Name ) ;
125+ var propertyName = GetPropertyName ( field . Name ) ;
126126 var getMethodName = $ "Get{ propertyName } ";
127127 var setMethodName = $ "Set{ propertyName } ";
128128
129- var hasExistingProperty = field ? . DeclaringType ? . Properties . Any ( p => p . Name . Equals ( propertyName , System . StringComparison . Ordinal ) ) ;
130- var hasExistingField = field ? . DeclaringType ? . Fields . Any ( f => f . Name . Equals ( propertyName , System . StringComparison . Ordinal ) ) ;
129+ var hasExistingProperty = field ? . DeclaringType ? . Properties . Any ( p => p . Name . Equals ( propertyName , System . StringComparison . Ordinal ) && ChkPropertyVisible ( p ) ) ;
130+ var hasExistingField = field ? . DeclaringType ? . Fields . Any ( f => f . Name . Equals ( propertyName , System . StringComparison . Ordinal ) && ChkFieldVisible ( f ) ) ;
131131
132132 return ! hasExistingProperty . IsTrue ( ) && ! hasExistingField . IsTrue ( ) &&
133133 // Class X has a static field of type DependencyProperty [Name]Property
@@ -178,8 +178,40 @@ private static bool IsAssignableTo(TypeReference type, string targetTypeName)
178178 return type . FullName == targetTypeName ;
179179
180180 return type . FullName == targetTypeName || IsAssignableTo ( typeDefenition . BaseType , targetTypeName ) ;
181+ }
182+
183+ private static bool ChkPropertyVisible ( PropertyDefinition property )
184+ {
185+ MethodDefinition method ;
186+ bool get_visible = false ;
187+ bool set_visible = false ;
188+
189+ if ( ( method = property . GetMethod ) != null &&
190+ ( DocUtils . IsExplicitlyImplemented ( method ) ||
191+ ( ! method . IsPrivate && ! method . IsAssembly && ! method . IsFamilyAndAssembly ) ) )
192+ get_visible = true ;
193+
194+ if ( ( method = property . SetMethod ) != null &&
195+ ( DocUtils . IsExplicitlyImplemented ( method ) ||
196+ ( ! method . IsPrivate && ! method . IsAssembly && ! method . IsFamilyAndAssembly ) ) )
197+ set_visible = true ;
198+
199+ if ( ( set_visible == false ) && ( get_visible == false ) )
200+ return false ;
201+ else
202+ return true ;
181203 }
182204
205+ private static bool ChkFieldVisible ( FieldDefinition field )
206+ {
207+ TypeDefinition declType = ( TypeDefinition ) field . DeclaringType ;
208+
209+ if ( declType . IsEnum && field . Name == "value__" )
210+ return false ; // This member of enums aren't documented.
211+
212+ return field . IsPublic || field . IsFamily || field . IsFamilyOrAssembly ;
213+
214+ }
183215
184216 }
185217 internal static class NBoolExtensions
0 commit comments