From d33133bf37f615105d20ee69f4f02b2ea4099b67 Mon Sep 17 00:00:00 2001 From: Eideren Date: Fri, 12 Sep 2025 12:38:53 +0200 Subject: [PATCH] fix: Presentation, remove false-positive prone exception --- .../ViewModels/ViewModelBase.cs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/sources/presentation/Stride.Core.Presentation/ViewModels/ViewModelBase.cs b/sources/presentation/Stride.Core.Presentation/ViewModels/ViewModelBase.cs index 1046423504..966d87fc76 100644 --- a/sources/presentation/Stride.Core.Presentation/ViewModels/ViewModelBase.cs +++ b/sources/presentation/Stride.Core.Presentation/ViewModels/ViewModelBase.cs @@ -13,10 +13,6 @@ namespace Stride.Core.Presentation.ViewModels; /// public abstract class ViewModelBase : INotifyPropertyChanging, INotifyPropertyChanged, IDestroyable { -#if DEBUG - private readonly List changingProperties = []; -#endif - /// /// 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. @@ -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)) @@ -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 } }