[Mono-bugs] [Bug 665171] New: AvoidVisibleFieldsRule only looks at [SuppressMessage] metadata at get / set or add / remove

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jan 18 11:01:34 EST 2011



           Summary: AvoidVisibleFieldsRule only looks at [SuppressMessage]
                    metadata at get / set or add / remove
    Classification: Mono
           Product: Mono: Tools
           Version: 2.10.x
          Platform: 64bit
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Gendarme
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: ethan_j_brown at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.634.0 Safari/534.16

FxCop allows a suppression for NonConstantFieldsShouldNotBeVisible to be setup
like this:

"CA2211:NonConstantFieldsShouldNotBeVisible", Justification="Add/remove is
thread-safe for events in .NET.")]
public static EventHandler<SimpleAuthenticationFailureEventArgs>

However, Gendarme fails to look at this metadata.  It expects a suppression to
occur at the add/remove or get/set level.

public static EventHandler<SimpleAuthenticationFailureEventArgs>
"CA2211:NonConstantFieldsShouldNotBeVisible", Justification="Add/remove is
thread-safe for events in .NET.")]
    add {}
"CA2211:NonConstantFieldsShouldNotBeVisible", Justification="Add/remove is
thread-safe for events in .NET.")]
    remove {}

Reproducible: Always

Steps to Reproduce:
1.Run Gendarme on attached assembly with ruleset EPS
Actual Results:  
2. AvoidVisibleFieldsRule

Problem: This type contains visible instance fields. A field should be an
implementation detail and encapsulated within a property or method.
* Severity: Medium, Confidence: Total
* Target:   EPS.Web.Authentication.SimpleAuthenticationFailureHandler
* Location:
* Source:  
* Details:  Field 'AuthenticationFailure' should be private or internal and
itsvalue accessed through a property.

Solution: Use a property or method instead.
More info available at:

Expected Results:  
No defect.

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