C# Property Attributes not showing correctly

Topics: Features, General Discussion, General Questions, Sandcastle
Sep 16, 2009 at 9:32 PM

Hi, I'm not sure if this is a DocProject problem or SandCastle, so I'm starting here.  We have custom attributes on our properties that look like this:

 

        /// <summary>
        /// Gets or sets the product id.
        /// </summary>
        /// <value>The product id.</value>
        [DataMember(IsRequired = true)]
        [DuplicateIgnore]
        [PersistenceMember("Product", "PrdctID")]
        [PersistenceMember("ExchangeOption", "PrdctID")]
        [PersistenceMember("Currency", "CrrncyID")]
        [PersistenceMember("InterestRate", "PrdctID")]
        [NotNullValidator(NullableUntilPersisted = true)]
        public  int? ProductId
        {
            get { return (int?) this.GetValue(ProductIdProperty); }
            set { this.SetValue(ProductIdProperty, value); }
        }

 

        /// <summary>

        /// Gets or sets the abbreviation.

        /// </summary>

        /// <value>The abbreviation.</value>

        [DataMember(IsRequired = true)]

        [StringLengthValidator(1, 20)]

        public  string Abbreviation

        {

            get { return (string) this.GetValue(AbbreviationProperty); }

            set { this.SetValue(AbbreviationProperty, value); }

        }

 

The help gets generated correctly except for the StringLengthValidator attribute.  In the help file, the 1, 20 is not shown, it just shows the comma.  I've searched around but have not been able to find anything that would point to what is wrong.  I know that we could add XML comments with the same information, but the attribute is already showing up, its just missing the key data.  Any ideas?

 

Thanks.

Coordinator
Sep 17, 2009 at 7:15 PM

Hi,

It's hard to say, but I doubt it's a DocProject issue.

What does the reflection.xml file look like? (It's in the buildhelp\ folder of your DocProject or DocSite).  See if the constant values are present.  Also compare the reflection information for DataMember(IsRequired = true) and see how IsRequied is specified as true.

Also, you may be interested in using code contracts instead of the Validation application block.  See this blog post for more information:

http://davesexton.com/blog/blogs/blog/archive/2009/09/13/sandcastle-with-code-contracts.aspx 

- Dave

Sep 24, 2009 at 2:28 PM

Hi Dave,

Here's a related part of the reflection.xml file.  The constant values are there, and I don't see a difference between the two attributes.  Anything else I can look at?

Thanks.

 

     <attributes>
        <attribute>
          <type api="T:SolArc.RightAngle.Common.BusinessEntities.PersistenceMemberAttribute" ref="true" />
          <argument>
            <type api="T:System.String" ref="true" />
            <value>AttributeType</value>
          </argument>
          <argument>
            <type api="T:System.String" ref="true" />
            <value>Abbreviation</value>
          </argument>
        </attribute>
        <attribute>
          <type api="T:SolArc.RightAngle.Common.BusinessEntities.BusinessLogic.StringLengthValidatorAttribute" ref="true" />
          <argument>
            <type api="T:System.Int32" ref="false" />
            <value>1</value>
          </argument>
          <argument>
            <type api="T:System.Int32" ref="false" />
            <value>255</value>
          </argument>
        </attribute>
        <attribute>
          <type api="T:System.Runtime.Serialization.DataMemberAttribute" ref="true" />
          <assignment name="IsRequired">
            <type api="T:System.Boolean" ref="false" />
            <value>True</value>
          </assignment>
        </attribute>
      </attributes>

     <attributes>

        <attribute>

          <type api="T:NameSpace.Common.BusinessEntities.PersistenceMemberAttribute" ref="true" />

          <argument>

            <type api="T:System.String" ref="true" />

            <value>AttributeType</value>

          </argument>

          <argument>

            <type api="T:System.String" ref="true" />

            <value>Abbreviation</value>

          </argument>

        </attribute>

        <attribute>

          <type api="T:NameSpace.Common.BusinessEntities.BusinessLogic.StringLengthValidatorAttribute" ref="true" />

          <argument>

            <type api="T:System.Int32" ref="false" />

            <value>1</value>

          </argument>

          <argument>

            <type api="T:System.Int32" ref="false" />

            <value>255</value>

          </argument>

        </attribute>

        <attribute>

          <type api="T:System.Runtime.Serialization.DataMemberAttribute" ref="true" />

          <assignment name="IsRequired">

            <type api="T:System.Boolean" ref="false" />

            <value>True</value>

          </assignment>

        </attribute>

      </attributes>

 

Coordinator
Sep 25, 2009 at 2:35 AM

Hi,

I'd like to know if you can reproduce the problem in a more specific test case.  Could you extract the property and its direct dependencies (e.g., StringLengthValidatorAttribute) into a stand-alone test project and then see what Sandcastle/DocProject produces for it?  If you can reproduce the issue then please send me the test assembly and I will try to repro.  (You can rip out the implementation if you'd like.)

- Dave

Sep 25, 2009 at 3:05 PM

ok, I created a simple test project and got the same results.  Do you want me to zip up the entire solution?  Where should I send it cause I don't see anywhere to attach it here.

Coordinator
Sep 26, 2009 at 9:38 AM

Hi,

Sorry I forgot to mention my contact info.  Send me your email address on my contact form and I'll send you mine:

http://davesexton.com/Contact/Default.aspx 

Thanks,
Dave

Sep 29, 2009 at 2:21 PM

Dave,

I sent you my contact info the other day, so just wanted to make sure you received it.

Thanks.

Coordinator
Sep 29, 2009 at 4:40 PM

Hi,

Sorry I didn't receive it, thanks for following-up.  Please try my CodePlex contact form instead.

- Dave

Sep 29, 2009 at 5:12 PM

that form isn't working.  I can't type into any of the fields except for the captcha field at the bottom.

Here, just email me your contact info at this email address:

dbonneca@yahoo.com

 

Thanks.

Coordinator
Dec 24, 2009 at 10:45 AM

Hi,

It appears that literal numeric values in attributes are not currently supported by the Sandcastle syntax generators.  I've reported the issue to the Sandcastle team:

http://sandcastle.codeplex.com/WorkItem/View.aspx?WorkItemId=6779

- Dave