[NUI] Remove CA2000 false alarm in Navigator (#2729)
authorJaehyun Cho <29364140+jaehyun0cho@users.noreply.github.com>
Fri, 12 Mar 2021 01:44:10 +0000 (10:44 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Wed, 17 Mar 2021 06:50:14 +0000 (15:50 +0900)
Since the pushed views are added to NavigationPages and are disposed in
Navigator.Dispose(), the CA2000 in Navigator is false alarm.

To remove the CA2000 false alarm, SuppressMessage for CA2000 is added.

Co-authored-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
src/Tizen.NUI.Components/Controls/Navigation/Navigator.cs

index 10f371c..b79addc 100755 (executable)
@@ -18,6 +18,7 @@
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
 using System.Threading.Tasks;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Binding;
@@ -377,6 +378,9 @@ namespace Tizen.NUI.Components
         /// </summary>
         /// <param name="content">The content of Dialog.</param>
         [EditorBrowsable(EditorBrowsableState.Never)]
+        [SuppressMessage("Microsoft.Reliability",
+                         "CA2000:DisposeObjectsBeforeLosingScope",
+                         Justification = "The pushed views are added to NavigationPages and are disposed in Navigator.Dispose().")]
         public static void ShowDialog(View content = null)
         {
             var window = NUIApplication.GetDefaultWindow();
@@ -397,6 +401,9 @@ namespace Tizen.NUI.Components
         /// <param name="content">The content of AlertDialog.</param>
         /// <param name="actionContent">The action content of AlertDialog.</param>
         [EditorBrowsable(EditorBrowsableState.Never)]
+        [SuppressMessage("Microsoft.Reliability",
+                         "CA2000:DisposeObjectsBeforeLosingScope",
+                         Justification = "The pushed views are added to NavigationPages and are disposed in Navigator.Dispose().")]
         public static void ShowAlertDialog(View titleContent, View content, View actionContent)
         {
             var window = NUIApplication.GetDefaultWindow();
@@ -420,6 +427,9 @@ namespace Tizen.NUI.Components
         /// <param name="negativeButtonText">The negative button text in the action content of AlertDialog.</param>
         /// <param name="negativeButtonClickedHandler">The clicked callback of the negative button in the action content of AlertDialog.</param>
         [EditorBrowsable(EditorBrowsableState.Never)]
+        [SuppressMessage("Microsoft.Reliability",
+                         "CA2000:DisposeObjectsBeforeLosingScope",
+                         Justification = "The pushed views are added to NavigationPages and are disposed in Navigator.Dispose().")]
         public static void ShowAlertDialog(string title = null, string message = null, string positiveButtonText = null, EventHandler<ClickedEventArgs> positiveButtonClickedHandler = null, string negativeButtonText = null, EventHandler<ClickedEventArgs> negativeButtonClickedHandler = null)
         {
             var window = NUIApplication.GetDefaultWindow();