GuOrg / Gu.State

MIT License
9 stars 3 forks source link

Bug in IgnoreType when more than one type #60

Open JohanLarsson opened 7 years ago

JohanLarsson commented 7 years ago
        private static readonly PropertiesSettings ChangeTrackerSettings = new PropertiesSettingsBuilder().IgnoreType<ICommand>()
                                                                                                          .IgnoreType<BitmapSource>()
                                                                                                          .CreateSettings();
System.NotSupportedException: 'Track.Changes(x, y) failed.

The type DependencyObjectType does not notify changes.

The type Dispatcher does not notify changes.

The type Thread does not notify changes.

The type ExecutionContext does not notify changes.

The type DispatcherHooks does not notify changes.

The property PositivesDirectory.Images of type ObservableBatchCollection<PositiveViewModel> is not supported.

The property PositiveViewModel.Rectangles of type ObservableBatchCollection<RectangleViewModel> is not supported.

The property RectangleViewModel.BitmapSource of type BitmapSource is not supported.

The property DependencyObject.DependencyObjectType of type DependencyObjectType is not supported.

The property DispatcherObject.Dispatcher of type Dispatcher is not supported.

The property Dispatcher.Thread of type Thread is not supported.

The property Thread.ExecutionContext of type ExecutionContext is not supported.

The property Dispatcher.Hooks of type DispatcherHooks is not supported.

Solve the problem by any of:

* Implement INotifyPropertyChanged for DependencyObjectType or use a type that does.

* Implement INotifyPropertyChanged for Dispatcher or use a type that does.

* Use a type that implements INotifyPropertyChanged instead of Thread.

* Use a type that implements INotifyPropertyChanged instead of ExecutionContext.

* Implement INotifyPropertyChanged for DispatcherHooks or use a type that does.

* Make ObservableBatchCollection<PositiveViewModel> immutable or use an immutable type.

* Make PositiveViewModel immutable or use an immutable type.

* Make ObservableBatchCollection<RectangleViewModel> immutable or use an immutable type.

* Make RectangleViewModel immutable or use an immutable type.

* Make BitmapSource immutable or use an immutable type.

* Make DependencyObjectType immutable or use an immutable type.

* Make Dispatcher immutable or use an immutable type.

* Use an immutable type instead of Thread.

* Use an immutable type instead of ExecutionContext.

* Make DispatcherHooks 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 PositivesDirectory.Images.

    - The property PositiveViewModel.Rectangles.

    - The property RectangleViewModel.BitmapSource.

    - The property DependencyObject.DependencyObjectType.

    - The property DispatcherObject.Dispatcher.

    - The property Dispatcher.Thread.

    - The property Thread.ExecutionContext.

    - The property Dispatcher.Hooks.

    - The type ObservableBatchCollection<PositiveViewModel>.

    - The type PositiveViewModel.

    - The type ObservableBatchCollection<RectangleViewModel>.

    - The type RectangleViewModel.

    - The type BitmapSource.

    - The type DependencyObjectType.

    - The type Dispatcher.

    - The type Thread.

    - The type ExecutionContext.

    - The type DispatcherHooks.