https://bugzilla.novell.com/show_bug.cgi?id=676720
https://bugzilla.novell.com/show_bug.cgi?id=676720#c0 Summary: New Rule - Detect incorrect "magic" strings passed to INotifyPropertyChanged.PropertyChanged Classification: Mono Product: Mono: Tools Version: 2.10.x Platform: 64bit OS/Version: Other Status: NEW Severity: Enhancement Priority: P5 - None Component: Gendarme AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; Windows NT 6.1) AppleWebKit/534.23 (KHTML, like Gecko) Chrome/11.0.686.1 Safari/534.23 There are many MVVM frameworks that provide an Expression<Func<>> style of compile time validation when implementing INotifyPropertyChanged. (For instance, Caliburn.Micro provides a base class that examines the expression and returns the name of a property of the class to the PropertyChanged event as expected by the framework -- http://caliburnmicro.codeplex.com/SourceControl/changeset/view/12fcdc26b449#src%2fCaliburn.Micro.Silverlight%2fPropertyChangedBase.cs) However, passing a "magic" string is still pretty common when implementing INotifyPropertyChanged yourself in WPF / Silverlight / Moonlight / WP7, and has a lot better performance. There are rumors that WPF5 will have some sort of compiler support, but not sure if that will happen or not. Here are the MSDN docs on INotifyPropertyChanged.PropertyChanged http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.propertychanged.aspx I think it would be nice to have a rule that looks at calls made to the PropertyChanged event to determine if the magic string being passed refers to an actual property of the class or not. If there is no matching property name in the inheritance hierarchy, that would be considered a violation. Reproducible: Always Steps to Reproduce: 1. 2. 3. -- 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
