Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ namespace Stride.Core.Presentation.ViewModels;
/// </summary>
public abstract class ViewModelBase : INotifyPropertyChanging, INotifyPropertyChanged, IDestroyable
{
#if DEBUG
private readonly List<string> changingProperties = [];
#endif

/// <summary>
/// A collection of property names that are dependent. For each entry of this collection, if the key property name is notified
/// as being changed, then the property names in the value will also be notified as being changed.
Expand Down Expand Up @@ -239,13 +235,6 @@ protected virtual void OnPropertyChanging(params string[] propertyNames)

foreach (var propertyName in propertyNames)
{
#if DEBUG
if (changingProperties.Contains(propertyName))
throw new InvalidOperationException($"OnPropertyChanging called twice for property '{propertyName}' without invoking OnPropertyChanged between calls.");

changingProperties.Add(propertyName);
#endif

propertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));

if (DependentProperties.TryGetValue(propertyName, out var dependentProperties))
Expand Down Expand Up @@ -274,13 +263,6 @@ protected virtual void OnPropertyChanged(params string[] propertyNames)
OnPropertyChanged(reverseList);
}
propertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

#if DEBUG
if (!changingProperties.Contains(propertyName))
throw new InvalidOperationException($"OnPropertyChanged called for property '{propertyName}' but OnPropertyChanging was not invoked before.");

changingProperties.Remove(propertyName);
#endif
}
}

Expand Down
Loading