Skip to content

Commit f1ab0a6

Browse files
Eiderenxen2
authored andcommitted
fix: Presentation, remove false-positive prone exception
1 parent 33e71f3 commit f1ab0a6

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

sources/presentation/Stride.Core.Presentation/ViewModels/ViewModelBase.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ namespace Stride.Core.Presentation.ViewModels;
1313
/// </summary>
1414
public abstract class ViewModelBase : INotifyPropertyChanging, INotifyPropertyChanged, IDestroyable
1515
{
16-
#if DEBUG
17-
private readonly List<string> changingProperties = [];
18-
#endif
19-
2016
/// <summary>
2117
/// A collection of property names that are dependent. For each entry of this collection, if the key property name is notified
2218
/// 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)
239235

240236
foreach (var propertyName in propertyNames)
241237
{
242-
#if DEBUG
243-
if (changingProperties.Contains(propertyName))
244-
throw new InvalidOperationException($"OnPropertyChanging called twice for property '{propertyName}' without invoking OnPropertyChanged between calls.");
245-
246-
changingProperties.Add(propertyName);
247-
#endif
248-
249238
propertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
250239

251240
if (DependentProperties.TryGetValue(propertyName, out var dependentProperties))
@@ -274,13 +263,6 @@ protected virtual void OnPropertyChanged(params string[] propertyNames)
274263
OnPropertyChanged(reverseList);
275264
}
276265
propertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
277-
278-
#if DEBUG
279-
if (!changingProperties.Contains(propertyName))
280-
throw new InvalidOperationException($"OnPropertyChanged called for property '{propertyName}' but OnPropertyChanging was not invoked before.");
281-
282-
changingProperties.Remove(propertyName);
283-
#endif
284266
}
285267
}
286268

0 commit comments

Comments
 (0)