GuOrg / Gu.State

MIT License
9 stars 3 forks source link

Error message when using structs #56

Closed ErikWahlstrom closed 8 years ago

ErikWahlstrom commented 8 years ago

Would be nice with a more obvious error message if struct implements INotifyPropertyChanged

JohanLarsson commented 8 years ago

Now we get this message when trying to track a mutable notifying struct:

Track.VerifyCanTrackChanges(x, y) failed.
The type NotifyingStruct is a mutable struct that implements INotifyPropertyChanged.
  As it is a value type subscribing to changes does not make sense.
The property With<NotifyingStruct>.Value of type NotifyingStruct is not supported.
Solve the problem by any of:
* Make NotifyingStruct immutable or use an immutable type.
  - For immutable types the following must hold:
    - Must be a sealed class or a struct.
    - All fields and properties must be readonly.
    - All field and property types must be immutable.
    - All indexers must be readonly.
    - Event fields are ignored.
* Use PropertiesSettings and specify how change tracking is performed:
  - ReferenceHandling.Structural means that a the entire graph is tracked.
  - ReferenceHandling.References means that only the root level changes are tracked.
  - Exclude a combination of the following:
    - The property With<NotifyingStruct>.Value.
    - The type NotifyingStruct.