Attributes on types and members are missing.

Jun 19, 2012 at 10:06 AM
Edited Jun 20, 2012 at 9:38 AM

Dear All,

First of all, thanks a lot for such a great tool. Could you please give me some hints on how to configure the DocumentationProject so, that attributes other then Serialized would get documented too? Namely I am using heavily things like "StructLayout" and "MarshalAs". But they never get into the API documentation. What do I do wrong?

Thanks everybody in advance.

Jun 19, 2012 at 8:47 PM

If using SHFB, did you set the DocumentAttributes project property to True?  It's false by default to remove all but a few specific attributes.  However, even when enabled, some of the interop attributes will still fail to appear as their metadata does not appear to be accessible to the MRefBuilder tool.  StructLayout is one of them but I don't recall off-hand if MarshalAs is another.  I looked into fixing it in MRefBuilder but was unable to find where such information is stored.



Jun 20, 2012 at 9:41 AM

Yes. The DocumentAttributes property is set to True. I looked at the MSDN documentation and noticed strange thing. I could find only few attributes documented there. Namely, Flags, Security..., Serializable, AttributeUsage and couple more. Is that a general problem?

Jun 20, 2012 at 8:31 PM

It's not a problem.  Which attributes get documented on MSDN is largely up to Microsoft.  For the configuration supplied with Sandcastle and SHFB on CodePlex, most of the compiler related and internal attributes that provide no useful information are turned off while most of the designer related attributes and some others are allowed through along with custom attributes in your own code.  When attributes are suppressed completely, certain ones are still allowed through such as Flags, Serializable, etc. as they provide important information.  As I noted, there's a problem with some of the interop attributes and they won't show up at all even though they are enabled in the filter.



Jun 21, 2012 at 8:15 AM

Thanks a lot, Eric.

So, this means I have to drop the issue, since there is no way for me to get those attributes documented?

Jun 21, 2012 at 8:25 PM

For now, that is the case.  I took a look at solving the issue a while a go but couldn't find out how to get the missing interop attribute information from the reflection data that MRefBuilder extracts from the assemblies.  Maybe someone else can take a look at the code and see if they can find it.