https://bugzilla.novell.com/show_bug.cgi?id=665171
https://bugzilla.novell.com/show_bug.cgi?id=665171#c0 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: [email protected] ReportedBy: [email protected] QAContact: [email protected] 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: [SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification="Add/remove is thread-safe for events in .NET.")] public static EventHandler<SimpleAuthenticationFailureEventArgs> AuthenticationFailure; 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> AuthenticationFailure { [SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification="Add/remove is thread-safe for events in .NET.")] add {} [SuppressMessage("Microsoft.Usage", "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 2. 3. 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: System.EventHandler`1<EPS.Web.Authentication.SimpleAuthenticationFailureEventArgs> EPS.Web.Authentication.SimpleAuthenticationFailureHandler::AuthenticationFailure * Source: C:\Source\Common\source\EPS.Web.Authentication\SimpleAuthenticationFailureHandler.cs(≈18) * 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: https://github.com/spouliot/gendarme/wiki/Gendarme.Rules.Design.AvoidVisibleFieldsRule(2.10) 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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
