summaryrefslogtreecommitdiffstats
path: root/tools/Sandcastle/Source/Reflection
diff options
context:
space:
mode:
Diffstat (limited to 'tools/Sandcastle/Source/Reflection')
-rw-r--r--tools/Sandcastle/Source/Reflection/ApiFilter.cs6
-rw-r--r--tools/Sandcastle/Source/Reflection/ExternalDocumentedFilter.cs82
-rw-r--r--tools/Sandcastle/Source/Reflection/GlobalSuppressions.cs4
-rw-r--r--tools/Sandcastle/Source/Reflection/Properties/AssemblyInfo.cs4
4 files changed, 80 insertions, 16 deletions
diff --git a/tools/Sandcastle/Source/Reflection/ApiFilter.cs b/tools/Sandcastle/Source/Reflection/ApiFilter.cs
index 201878f..b24cbbb 100644
--- a/tools/Sandcastle/Source/Reflection/ApiFilter.cs
+++ b/tools/Sandcastle/Source/Reflection/ApiFilter.cs
@@ -62,6 +62,12 @@ namespace Microsoft.Ddue.Tools.Reflection {
#region Public API
+ public virtual bool IsDocumentedInterface(TypeNode type)
+ {
+ if (type == null) throw new ArgumentException("type");
+ return (apiFilter.IsExposedType(type));
+ }
+
public virtual bool HasExposedMembers(TypeNode type)
{
if (type == null) throw new ArgumentNullException("type");
diff --git a/tools/Sandcastle/Source/Reflection/ExternalDocumentedFilter.cs b/tools/Sandcastle/Source/Reflection/ExternalDocumentedFilter.cs
index e7f0cf7..9044fc5 100644
--- a/tools/Sandcastle/Source/Reflection/ExternalDocumentedFilter.cs
+++ b/tools/Sandcastle/Source/Reflection/ExternalDocumentedFilter.cs
@@ -15,20 +15,31 @@ namespace Microsoft.Ddue.Tools.Reflection {
public class ExternalDocumentedFilter : ApiFilter {
+ bool protectedSealedVisible = false;
+ bool noPIA = false;
+
public ExternalDocumentedFilter() : base() { }
- public ExternalDocumentedFilter(XPathNavigator configuration) : base(configuration) { }
+ public ExternalDocumentedFilter(XPathNavigator configuration)
+ : base(configuration)
+ {
+ protectedSealedVisible = (bool)configuration.Evaluate("boolean(protectedSealed[@expose='true'])");
+ noPIA = (bool)configuration.Evaluate("not(boolean(noPIA[@expose='false']))");
+ }
- public override bool IsExposedMember(Member member) {
+ public override bool IsExposedMember(Member member)
+ {
if (member == null) throw new ArgumentNullException("member");
+ TypeNode type = member.DeclaringType;
// if the member isn't visible, we certainly won't expose it...
- if (!member.IsVisibleOutsideAssembly) return (false);
+ if (!member.IsVisibleOutsideAssembly && !(protectedSealedVisible && type.IsSealed && (member.IsFamily || member.IsFamilyOrAssembly)))
+ return (false);
// ...but there are also some visible members we won't expose.
- TypeNode type = member.DeclaringType;
// member of delegates are not exposed
if (type.NodeType == NodeType.DelegateNode) return (false);
// accessor methods for properties and events are not exposed
- if (member.IsSpecialName && (member.NodeType == NodeType.Method)) {
+ if (member.IsSpecialName && (member.NodeType == NodeType.Method))
+ {
string name = member.Name.Name;
if (NameContains(name, "get_")) return (false);
if (NameContains(name, "set_")) return (false);
@@ -38,7 +49,8 @@ namespace Microsoft.Ddue.Tools.Reflection {
}
// the value field of enumerations is not exposed
- if (member.IsSpecialName && (type.NodeType == NodeType.EnumNode) && (member.NodeType == NodeType.Field)) {
+ if (member.IsSpecialName && (type.NodeType == NodeType.EnumNode) && (member.NodeType == NodeType.Field))
+ {
string name = member.Name.Name;
if (name == "value__") return (false);
}
@@ -47,10 +59,11 @@ namespace Microsoft.Ddue.Tools.Reflection {
// change of plan -- yes they are
// if (type.IsSealed && (member.IsFamily || member.IsFamilyOrAssembly)) return(false);
- // One more test to deal with a case: a private method is an explicit implementation for
+ // One more test to deal with a wierd case: a private method is an explicit implementation for
// a property accessor, but is not marked with the special name flag. To find these, test for
// the accessibility of the methods they implement
- if (member.IsPrivate && member.NodeType == NodeType.Method) {
+ if (member.IsPrivate && member.NodeType == NodeType.Method)
+ {
Method method = (Method)member;
MethodList implements = method.ImplementedInterfaceMethods;
if ((implements.Count > 0) && (!IsExposedMember(implements[0]))) return (false);
@@ -60,19 +73,60 @@ namespace Microsoft.Ddue.Tools.Reflection {
return (base.IsExposedMember(member));
}
+
// we are satistied with the default namespace expose test, so don't override it
- public override bool IsExposedType(TypeNode type) {
+ public override bool IsExposedType(TypeNode type)
+ {
if (type == null) throw new ArgumentNullException("type");
+
+ if (!type.IsVisibleOutsideAssembly)
+ return false;
+
+ // filter out no-PIA COM types
+ if (!noPIA)
+ {
+ if (IsEmbeddedInteropType(type))
+ return false;
+ }
// expose any visible types allowed by the base filter
- if (type.IsVisibleOutsideAssembly) {
- return (base.IsExposedType(type));
- } else {
- return (false);
+ return (base.IsExposedType(type));
+ }
+
+
+ // ApiFilter was extended to support interfaces that are filtered
+ // out (embedded interop types) but still contribute to
+ // the list of a type's implemented interfaces. See change
+ // to MrefWriter.cs, method GetExposedInterfaces.
+
+ public override bool IsDocumentedInterface(TypeNode type)
+ {
+ if (!noPIA && !IsEmbeddedInteropType(type))
+ return true;
+
+ return base.IsDocumentedInterface(type);
+ }
+
+ private bool IsEmbeddedInteropType(TypeNode type)
+ {
+ bool compilerGeneratedAttribute = false;
+ bool typeIdentifierAttribute = false;
+ for (int i = 0; i < type.Attributes.Count; i++)
+ {
+ if (type.Attributes[i].Type.FullName == "System.Runtime.CompilerServices.CompilerGeneratedAttribute")
+ compilerGeneratedAttribute = true;
+ if (type.Attributes[i].Type.FullName == "System.Runtime.InteropServices.TypeIdentifierAttribute")
+ typeIdentifierAttribute = true;
+
}
- // return(type.IsVisibleOutsideAssembly);
+ if (compilerGeneratedAttribute && typeIdentifierAttribute)
+ return true;
+ else
+ return false;
+
}
+
private static bool NameContains(string name, string substring) {
return (name.Contains(substring));
}
diff --git a/tools/Sandcastle/Source/Reflection/GlobalSuppressions.cs b/tools/Sandcastle/Source/Reflection/GlobalSuppressions.cs
index aff5272..8994661 100644
--- a/tools/Sandcastle/Source/Reflection/GlobalSuppressions.cs
+++ b/tools/Sandcastle/Source/Reflection/GlobalSuppressions.cs
@@ -53,3 +53,7 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Ddue.Tools.Reflection.NamespaceFilter.#TypeFilters")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Scope = "member", Target = "Microsoft.Ddue.Tools.Reflection.NamespaceFilter.#IsExposedNamespace(System.Compiler.Namespace)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Scope = "member", Target = "Microsoft.Ddue.Tools.Reflection.TypeFilter.#IsExposedType(System.Compiler.TypeNode)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Ddue.Tools.Reflection.ApiFilter.#IsDocumentedInterface(System.Compiler.TypeNode)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily", Scope = "member", Target = "Microsoft.Ddue.Tools.Reflection.ExternalDocumentedFilter.#.ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily", Scope = "member", Target = "Microsoft.Ddue.Tools.Reflection.ExternalDocumentedFilter.#.ctor(System.Xml.XPath.XPathNavigator)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.Ddue.Tools.Reflection.ExternalDocumentedFilter.#IsEmbeddedInteropType(System.Compiler.TypeNode)")]
diff --git a/tools/Sandcastle/Source/Reflection/Properties/AssemblyInfo.cs b/tools/Sandcastle/Source/Reflection/Properties/AssemblyInfo.cs
index a18dd70..6aa5a42 100644
--- a/tools/Sandcastle/Source/Reflection/Properties/AssemblyInfo.cs
+++ b/tools/Sandcastle/Source/Reflection/Properties/AssemblyInfo.cs
@@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("2.5.10626.00")]
-[assembly: AssemblyFileVersion("2.5.10626.00")]
+[assembly: AssemblyVersion("2.6.10621.1")]
+[assembly: AssemblyFileVersion("2.6.10621.1")]