Skip to content

Add analyzer to warn when [INotifyPropertyChanged] & co. are used when not needed #530

@Sergio0694

Description

@Sergio0694

Overview

The [INotifyPropertyChanged] and [ObservableObject] are meant to support cases where inheriting isn't possible, but it seems this point is easy to spot for a lot of folks, who just use these attributes instead of the base types. We should consider adding an analyzer to flag those cases and emit a warning. Specifically, these cases should produce a warning:

  • [INotifyPropertyChanged] on a type that doesn't have a base class.
  • [ObservableObject] on a type that doesn't have a base class.

Usage example

The following should produce a warning:

[ObservableObject]
public partial class MyViewModel
{
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request 📬A request for new changes to improve functionalitymvvm-toolkit 🧰Issues/PRs for the MVVM Toolkit

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions