[Mono-bugs] [Bug 671033] New: Exception for ConstructorShouldNotCallVirtualMethodsRule

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 10 13:34:20 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=671033

https://bugzilla.novell.com/show_bug.cgi?id=671033#c0


           Summary: Exception for
                    ConstructorShouldNotCallVirtualMethodsRule
    Classification: Mono
           Product: Mono: Tools
           Version: 2.10.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: Gendarme
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: knocte at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US)
AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13

NHibernate requires that all properties should be virtual, so we should code an
exception for this case for this rule. Offending code:

    public class User {
        protected User() { }

        public User(string emailAddress) {
            PaymentMethods = new List<UserPaymentMethod>();
            EmailAddress = emailAddress;
        }

        public virtual int Id { get; protected set; }
        public virtual string EmailAddress { get; protected set; }
    }

The exception proposed is to check if there's a class that inherits from
FluentNHibernate.Mapping.ClassMap<User>. If it exists, the rule should not
report about this problem.

Reproducible: Always

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list