22// The .NET Foundation licenses this file to you under the MIT license.
33// See the LICENSE file in the project root for more information.
44
5+ #pragma warning disable
6+
57using System ;
68using System . Collections . Generic ;
79using System . ComponentModel ;
10+ using System . Diagnostics ;
11+ using System . Diagnostics . CodeAnalysis ;
812using System . Runtime . CompilerServices ;
913using System . Threading . Tasks ;
1014
11- #pragma warning disable SA1300 , SA1649
12-
1315namespace Microsoft . Toolkit . Mvvm . ComponentModel
1416{
1517 /// <summary>
1618 /// A base class for objects implementing <see cref="INotifyPropertyChanged"/>.
1719 /// </summary>
18- public abstract class __NotifyPropertyChanged : INotifyPropertyChanged
20+ public abstract class NotifyPropertyChanged : INotifyPropertyChanged
1921 {
2022 /// <inheritdoc cref="INotifyPropertyChanged.PropertyChanged"/>
23+ [ ExcludeFromCodeCoverage ]
2124 public event PropertyChangedEventHandler ? PropertyChanged ;
2225
2326 /// <summary>
2427 /// Raises the <see cref="PropertyChanged"/> event.
2528 /// </summary>
2629 /// <param name="e">The input <see cref="PropertyChangedEventArgs"/> instance.</param>
30+ [ DebuggerNonUserCode ]
31+ [ ExcludeFromCodeCoverage ]
2732 protected virtual void OnPropertyChanged ( PropertyChangedEventArgs e )
2833 {
2934 PropertyChanged ? . Invoke ( this , e ) ;
@@ -33,6 +38,8 @@ protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
3338 /// Raises the <see cref="PropertyChanged"/> event.
3439 /// </summary>
3540 /// <param name="propertyName">(optional) The name of the property that changed.</param>
41+ [ DebuggerNonUserCode ]
42+ [ ExcludeFromCodeCoverage ]
3643 protected void OnPropertyChanged ( [ CallerMemberName ] string ? propertyName = null )
3744 {
3845 OnPropertyChanged ( new PropertyChangedEventArgs ( propertyName ) ) ;
@@ -50,6 +57,8 @@ protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
5057 /// <remarks>
5158 /// The <see cref="PropertyChanged"/> event is not raised if the current and new value for the target property are the same.
5259 /// </remarks>
60+ [ DebuggerNonUserCode ]
61+ [ ExcludeFromCodeCoverage ]
5362 protected bool SetProperty < T > ( ref T field , T newValue , [ CallerMemberName ] string ? propertyName = null )
5463 {
5564 if ( EqualityComparer < T > . Default . Equals ( field , newValue ) )
@@ -75,6 +84,8 @@ protected bool SetProperty<T>(ref T field, T newValue, [CallerMemberName] string
7584 /// <param name="comparer">The <see cref="IEqualityComparer{T}"/> instance to use to compare the input values.</param>
7685 /// <param name="propertyName">(optional) The name of the property that changed.</param>
7786 /// <returns><see langword="true"/> if the property was changed, <see langword="false"/> otherwise.</returns>
87+ [ DebuggerNonUserCode ]
88+ [ ExcludeFromCodeCoverage ]
7889 protected bool SetProperty < T > ( ref T field , T newValue , IEqualityComparer < T > comparer , [ CallerMemberName ] string ? propertyName = null )
7990 {
8091 if ( comparer . Equals ( field , newValue ) )
@@ -110,6 +121,8 @@ protected bool SetProperty<T>(ref T field, T newValue, IEqualityComparer<T> comp
110121 /// <remarks>
111122 /// The <see cref="PropertyChanged"/> event is not raised if the current and new value for the target property are the same.
112123 /// </remarks>
124+ [ DebuggerNonUserCode ]
125+ [ ExcludeFromCodeCoverage ]
113126 protected bool SetProperty < T > ( T oldValue , T newValue , Action < T > callback , [ CallerMemberName ] string ? propertyName = null )
114127 {
115128 if ( EqualityComparer < T > . Default . Equals ( oldValue , newValue ) )
@@ -136,6 +149,8 @@ protected bool SetProperty<T>(T oldValue, T newValue, Action<T> callback, [Calle
136149 /// <param name="callback">A callback to invoke to update the property value.</param>
137150 /// <param name="propertyName">(optional) The name of the property that changed.</param>
138151 /// <returns><see langword="true"/> if the property was changed, <see langword="false"/> otherwise.</returns>
152+ [ DebuggerNonUserCode ]
153+ [ ExcludeFromCodeCoverage ]
139154 protected bool SetProperty < T > ( T oldValue , T newValue , IEqualityComparer < T > comparer , Action < T > callback , [ CallerMemberName ] string ? propertyName = null )
140155 {
141156 if ( comparer . Equals ( oldValue , newValue ) )
@@ -202,6 +217,8 @@ protected bool SetProperty<T>(T oldValue, T newValue, IEqualityComparer<T> compa
202217 /// <remarks>
203218 /// The <see cref="PropertyChanged"/> event is not raised if the current and new value for the target property are the same.
204219 /// </remarks>
220+ [ DebuggerNonUserCode ]
221+ [ ExcludeFromCodeCoverage ]
205222 protected bool SetProperty < TModel , T > ( T oldValue , T newValue , TModel model , Action < TModel , T > callback , [ CallerMemberName ] string ? propertyName = null )
206223 where TModel : class
207224 {
@@ -233,6 +250,8 @@ protected bool SetProperty<TModel, T>(T oldValue, T newValue, TModel model, Acti
233250 /// <param name="callback">The callback to invoke to set the target property value, if a change has occurred.</param>
234251 /// <param name="propertyName">(optional) The name of the property that changed.</param>
235252 /// <returns><see langword="true"/> if the property was changed, <see langword="false"/> otherwise.</returns>
253+ [ DebuggerNonUserCode ]
254+ [ ExcludeFromCodeCoverage ]
236255 protected bool SetProperty < TModel , T > ( T oldValue , T newValue , IEqualityComparer < T > comparer , TModel model , Action < TModel , T > callback , [ CallerMemberName ] string ? propertyName = null )
237256 where TModel : class
238257 {
@@ -280,6 +299,8 @@ protected bool SetProperty<TModel, T>(T oldValue, T newValue, IEqualityComparer<
280299 /// <paramref name="taskNotifier"/> is different than the previous one, and it does not mean the new
281300 /// <see cref="Task"/> instance passed as argument is in any particular state.
282301 /// </remarks>
302+ [ DebuggerNonUserCode ]
303+ [ ExcludeFromCodeCoverage ]
283304 protected bool SetPropertyAndNotifyOnCompletion ( ref TaskNotifier ? taskNotifier , Task ? newValue , [ CallerMemberName ] string ? propertyName = null )
284305 {
285306 return SetPropertyAndNotifyOnCompletion ( taskNotifier ??= new ( ) , newValue , static _ => { } , propertyName ) ;
@@ -300,6 +321,8 @@ protected bool SetPropertyAndNotifyOnCompletion(ref TaskNotifier? taskNotifier,
300321 /// <remarks>
301322 /// The <see cref="PropertyChanged"/> event is not raised if the current and new value for the target property are the same.
302323 /// </remarks>
324+ [ DebuggerNonUserCode ]
325+ [ ExcludeFromCodeCoverage ]
303326 protected bool SetPropertyAndNotifyOnCompletion ( ref TaskNotifier ? taskNotifier , Task ? newValue , Action < Task ? > callback , [ CallerMemberName ] string ? propertyName = null )
304327 {
305328 return SetPropertyAndNotifyOnCompletion ( taskNotifier ??= new ( ) , newValue , callback , propertyName ) ;
@@ -338,6 +361,8 @@ protected bool SetPropertyAndNotifyOnCompletion(ref TaskNotifier? taskNotifier,
338361 /// <paramref name="taskNotifier"/> is different than the previous one, and it does not mean the new
339362 /// <see cref="Task{TResult}"/> instance passed as argument is in any particular state.
340363 /// </remarks>
364+ [ DebuggerNonUserCode ]
365+ [ ExcludeFromCodeCoverage ]
341366 protected bool SetPropertyAndNotifyOnCompletion < T > ( ref TaskNotifier < T > ? taskNotifier , Task < T > ? newValue , [ CallerMemberName ] string ? propertyName = null )
342367 {
343368 return SetPropertyAndNotifyOnCompletion ( taskNotifier ??= new ( ) , newValue , static _ => { } , propertyName ) ;
@@ -359,6 +384,8 @@ protected bool SetPropertyAndNotifyOnCompletion<T>(ref TaskNotifier<T>? taskNoti
359384 /// <remarks>
360385 /// The <see cref="PropertyChanged"/> event is not raised if the current and new value for the target property are the same.
361386 /// </remarks>
387+ [ DebuggerNonUserCode ]
388+ [ ExcludeFromCodeCoverage ]
362389 protected bool SetPropertyAndNotifyOnCompletion < T > ( ref TaskNotifier < T > ? taskNotifier , Task < T > ? newValue , Action < Task < T > ? > callback , [ CallerMemberName ] string ? propertyName = null )
363390 {
364391 return SetPropertyAndNotifyOnCompletion ( taskNotifier ??= new ( ) , newValue , callback , propertyName ) ;
@@ -373,6 +400,8 @@ protected bool SetPropertyAndNotifyOnCompletion<T>(ref TaskNotifier<T>? taskNoti
373400 /// <param name="callback">A callback to invoke to update the property value.</param>
374401 /// <param name="propertyName">(optional) The name of the property that changed.</param>
375402 /// <returns><see langword="true"/> if the property was changed, <see langword="false"/> otherwise.</returns>
403+ [ DebuggerNonUserCode ]
404+ [ ExcludeFromCodeCoverage ]
376405 private bool SetPropertyAndNotifyOnCompletion < TTask > ( ITaskNotifier < TTask > taskNotifier , TTask ? newValue , Action < TTask ? > callback , [ CallerMemberName ] string ? propertyName = null )
377406 where TTask : Task
378407 {
@@ -427,12 +456,16 @@ private interface ITaskNotifier<TTask>
427456 /// <summary>
428457 /// Gets or sets the wrapped <typeparamref name="TTask"/> value.
429458 /// </summary>
459+ [ DebuggerNonUserCode ]
460+ [ ExcludeFromCodeCoverage ]
430461 TTask ? Task { get ; set ; }
431462 }
432463
433464 /// <summary>
434465 /// A wrapping class that can hold a <see cref="Task"/> value.
435466 /// </summary>
467+ [ DebuggerNonUserCode ]
468+ [ ExcludeFromCodeCoverage ]
436469 protected sealed class TaskNotifier : ITaskNotifier < Task >
437470 {
438471 /// <summary>
@@ -465,6 +498,8 @@ internal TaskNotifier()
465498 /// A wrapping class that can hold a <see cref="Task{T}"/> value.
466499 /// </summary>
467500 /// <typeparam name="T">The type of value for the wrapped <see cref="Task{T}"/> instance.</typeparam>
501+ [ DebuggerNonUserCode ]
502+ [ ExcludeFromCodeCoverage ]
468503 protected sealed class TaskNotifier < T > : ITaskNotifier < Task < T > >
469504 {
470505 /// <summary>
0 commit comments