Skip to content

Instructions Unclear. #7

@WillEhrendreich

Description

@WillEhrendreich

In the SourceGenerator example, MvvmGenerator, it makes it seem like public properties are fair game.

because it can handle public properties that are COMPUTED, I took it to mean that all public properties are also able to receive the [AutoNotify] attribute, and the propertyChanged would be correctly handled.

This is absolutely not the case, and so I would like for there to be a readme that addresses this so that other devs are not confused as to why the generator "isn't working".

The Readme should mention how only computed public properties are valid, and this is only the case if something is raising the property changed event for all the variables in the computation and the [AutoNotify] attribute is on it.

Normal public properties are not valid for usage with the [AutoNotify] attribute.

Even if the example had included this:

 public partial class MainWindowViewModel
  {
  	//Note, [AutoNotify] is Not going to be generated if you 
              //assign it to any normal public property, such as an AutoProperty. 
  	//for example, This :
  	//
  	//	[AutoNotify]
  	//	public string FirstName { get; set; }
  	//	[AutoNotify]
  	//	public string LastName { get; set; }
  	//
  	//Will NOT cause the MvvmGenerator to consider them as candidates
              // to generate PropertyChanged invocations for. 
  	//The MvvmGenerator is still meant primarily to be used with fields, 
              // but with the added benefit/exception of public computed properties being also usable. 

  	[AutoNotify]
  	private string _firstName;
  	[AutoNotify]
  	private string _lastName;
  
  	[AutoNotify]
      public string FullName => $"{FirstName} {LastName}";
  }

I would not have wasted a day thinking I'd gone mad. lol.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions