From: Eunki, Hong Date: Fri, 2 Aug 2024 06:26:48 +0000 (+0900) Subject: [NUI] Remove various build warnings (phase 1) X-Git-Tag: submit/tizen/20240813.064948~1^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56d025a286d9561274f16e32f1af1d802a53206c;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Remove various build warnings (phase 1) Found some build warning list by below command dotnet build /p:BuildWithAnalyzer=True -consoleloggerparameters:NoSummary Their are too many warnings occurs, let we remove them by multiple phases. Signed-off-by: Eunki, Hong --- diff --git a/src/Tizen.NUI/src/internal/Common/DefaultItemLayoutProperty.cs b/src/Tizen.NUI/src/internal/Common/DefaultItemLayoutProperty.cs index ffec5b015..64cd221d9 100755 --- a/src/Tizen.NUI/src/internal/Common/DefaultItemLayoutProperty.cs +++ b/src/Tizen.NUI/src/internal/Common/DefaultItemLayoutProperty.cs @@ -21,6 +21,7 @@ namespace Tizen.NUI { /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707: Identifiers should not contain underscores")] public enum DefaultItemLayoutProperty { /// diff --git a/src/Tizen.NUI/src/internal/Common/RenderTask.cs b/src/Tizen.NUI/src/internal/Common/RenderTask.cs index ac8fbca79..99e65e280 100755 --- a/src/Tizen.NUI/src/internal/Common/RenderTask.cs +++ b/src/Tizen.NUI/src/internal/Common/RenderTask.cs @@ -66,6 +66,7 @@ namespace Tizen.NUI internal static readonly int RequiresSync = Interop.RenderTask.RequiresSyncGet(); } +#pragma warning disable CA1707 internal static SWIGTYPE_p_f_r_Dali__Vector2__bool DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION { get @@ -148,6 +149,7 @@ namespace Tizen.NUI return ret; } } +#pragma warning restore CA1707 public RenderTask() : this(Interop.RenderTask.NewRenderTask(), true) { @@ -405,6 +407,7 @@ namespace Tizen.NUI } /// 3 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707: Identifiers should not contain underscores")] public enum RefreshRate { REFRESH_ONCE = 0, diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 9db7ef81c..f8b162623 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -2085,7 +2085,7 @@ namespace Tizen.NUI.BaseComponents /// (Example : if we change SynchronousLoading property from 'true' to 'false', or if we call this function during UpdateImage) /// [EditorBrowsable(EditorBrowsableState.Never)] - protected virtual void UpdateImage(int key, PropertyValue value, bool requiredVisualCreation = true) + protected void UpdateImage(int key, PropertyValue value, bool requiredVisualCreation = true) { // Update image property map value as inputed value. if (key != 0) diff --git a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs index 0c90bc22f..215002124 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs @@ -1507,7 +1507,6 @@ namespace Tizen.NUI.BaseComponents }; private states currentStates; - private const string tag = "NUITEST"; private event EventHandler finishedEventHandler; private void OnFinished() diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs b/src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs index b1255b014..e7deb1ed7 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs @@ -1214,11 +1214,16 @@ namespace Tizen.NUI.BaseComponents /// /// Copy the previously selected text from the text control into the clipboard. /// + /// Thrown when argument is null. /// The textEditor control from which the text is copied. /// The copied text. /// 9 public static string CopyToClipboard(TextEditor textEditor) { + if (textEditor == null) + { + throw new ArgumentNullException(nameof(textEditor), "TextEditor should not be null."); + } string copiedText = Interop.TextEditor.CopyText(textEditor.SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return copiedText; @@ -1227,11 +1232,16 @@ namespace Tizen.NUI.BaseComponents /// /// Copy the previously selected text from the text control into the clipboard. /// + /// Thrown when argument is null. /// The textField control from which the text is copied. /// The copied text. /// 9 public static string CopyToClipboard(TextField textField) { + if (textField == null) + { + throw new ArgumentNullException(nameof(textField), "TextField should not be null."); + } string copiedText = Interop.TextField.CopyText(textField.SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return copiedText; @@ -1240,11 +1250,16 @@ namespace Tizen.NUI.BaseComponents /// /// Cut the previously selected text from the text control into the clipboard. /// + /// Thrown when argument is null. /// The textEditor control from which the text is cut. /// The cut text. /// 9 public static string CutToClipboard(TextEditor textEditor) { + if (textEditor == null) + { + throw new ArgumentNullException(nameof(textEditor), "TextEditor should not be null."); + } string cutText = Interop.TextEditor.CutText(textEditor.SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return cutText; @@ -1253,11 +1268,16 @@ namespace Tizen.NUI.BaseComponents /// /// Cut the previously selected text from the text control into the clipboard. /// + /// Thrown when argument is null. /// The textField control from which the text is cut. /// The cut text. /// 9 public static string CutToClipboard(TextField textField) { + if (textField == null) + { + throw new ArgumentNullException(nameof(textField), "TextField should not be null."); + } string cutText = Interop.TextField.CutText(textField.SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return cutText; @@ -1271,10 +1291,15 @@ namespace Tizen.NUI.BaseComponents /// the text will be appended to the last cursor position and the text control will gain focus. /// If some text inside the text control is selected, it will be replaced by the pasted text. /// + /// Thrown when argument is null. /// The textEditor control into which the text is pasted. /// 9 public static void PasteTo(TextEditor textEditor) { + if (textEditor == null) + { + throw new ArgumentNullException(nameof(textEditor), "TextEditor should not be null."); + } Interop.TextEditor.PasteText(textEditor.SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -1287,10 +1312,15 @@ namespace Tizen.NUI.BaseComponents /// the text will be appended to the last cursor position and the text control will gain focus. /// If some text inside the text control is selected, it will be replaced by the pasted text. /// + /// Thrown when argument is null. /// The textField control into which the text is pasted. /// 9 public static void PasteTo(TextField textField) { + if (textField == null) + { + throw new ArgumentNullException(nameof(textField), "TextEditor should not be null."); + } Interop.TextField.PasteText(textField.SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 59740e6cc..d0fa08a55 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -637,6 +637,7 @@ namespace Tizen.NUI.BaseComponents /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system, /// please set to true. /// + /// Thrown when set null. /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public ControlState ControlState @@ -651,6 +652,10 @@ namespace Tizen.NUI.BaseComponents { return; } + if (value == null) + { + throw new ArgumentNullException(nameof(value), "ControlState should not be null."); + } var prevState = ControlState; diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index 5a5f90b8e..e0a94fdef 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -1801,7 +1801,7 @@ namespace Tizen.NUI.BaseComponents /// Apply initial style to the view. /// [EditorBrowsable(EditorBrowsableState.Never)] - protected virtual void InitializeStyle(ViewStyle style = null) + protected void InitializeStyle(ViewStyle style = null) { if (style == null && ThemeManager.InitialThemeDisabled) { diff --git a/src/Tizen.NUI/src/public/Common/Matrix.cs b/src/Tizen.NUI/src/public/Common/Matrix.cs index 55e67607f..6b28fe08b 100755 --- a/src/Tizen.NUI/src/public/Common/Matrix.cs +++ b/src/Tizen.NUI/src/public/Common/Matrix.cs @@ -128,6 +128,7 @@ namespace Tizen.NUI /// /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1065: Do not raise exceptions in unexpected locations")] public static Matrix Identity { get diff --git a/src/Tizen.NUI/src/public/Common/Matrix3.cs b/src/Tizen.NUI/src/public/Common/Matrix3.cs index ffba8b569..2adeeb2e0 100755 --- a/src/Tizen.NUI/src/public/Common/Matrix3.cs +++ b/src/Tizen.NUI/src/public/Common/Matrix3.cs @@ -135,6 +135,7 @@ namespace Tizen.NUI /// /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1065: Do not raise exceptions in unexpected locations")] public static Matrix3 Identity { get diff --git a/src/Tizen.NUI/src/public/Common/RelativeVector3.cs b/src/Tizen.NUI/src/public/Common/RelativeVector3.cs index 744632f3b..3e24d2332 100755 --- a/src/Tizen.NUI/src/public/Common/RelativeVector3.cs +++ b/src/Tizen.NUI/src/public/Common/RelativeVector3.cs @@ -246,6 +246,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Vector3(RelativeVector3 relativeVector3) { + if (relativeVector3 == null) return null; return new Vector3(relativeVector3.X, relativeVector3.Y, relativeVector3.Z); } @@ -254,6 +255,7 @@ namespace Tizen.NUI /// 3 public static implicit operator RelativeVector3(Vector3 vec) { + if (vec == null) return null; return new RelativeVector3(vec.X, vec.Y, vec.Z); } diff --git a/src/Tizen.NUI/src/public/Common/TimePeriod.cs b/src/Tizen.NUI/src/public/Common/TimePeriod.cs index 028eb925f..0e1add1d0 100755 --- a/src/Tizen.NUI/src/public/Common/TimePeriod.cs +++ b/src/Tizen.NUI/src/public/Common/TimePeriod.cs @@ -55,6 +55,7 @@ namespace Tizen.NUI /// A delay before the time period in milliseconds /// /// 9 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1065: Do not raise exceptions in unexpected locations")] public int DelayMilliseconds { set @@ -74,6 +75,7 @@ namespace Tizen.NUI /// The duration of the time period in milliseconds /// /// 9 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1065: Do not raise exceptions in unexpected locations")] public int DurationMilliseconds { set diff --git a/src/Tizen.NUI/src/public/Common/WeakEvent.cs b/src/Tizen.NUI/src/public/Common/WeakEvent.cs index 1a24c9c8c..c57e7e691 100755 --- a/src/Tizen.NUI/src/public/Common/WeakEvent.cs +++ b/src/Tizen.NUI/src/public/Common/WeakEvent.cs @@ -45,6 +45,11 @@ namespace Tizen.NUI /// 12 public virtual void Add(T handler) { + if (handler == null) + { + // Do nothing. + return; + } handlers.Add(new WeakHandler(handler)); OnCountIncreased(); @@ -57,6 +62,12 @@ namespace Tizen.NUI /// 12 public virtual void Remove(T handler) { + if (handler == null) + { + // Do nothing. + return; + } + int lastIndex = handlers.FindLastIndex(item => item.Equals(handler)); if (lastIndex >= 0) diff --git a/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs b/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs index c2ad8a358..b37a11c2a 100755 --- a/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs +++ b/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs @@ -230,9 +230,9 @@ namespace Tizen.NUI /// Removes listener for drop targets /// /// The target view - /// The callback function to remove + /// The callback function to remove(Not used) /// 10 - public void RemoveListener(View targetView, DragAndDropEventHandler callback) + public void RemoveListener(View targetView, DragAndDropEventHandler _) { if (!targetEventDictionary.ContainsKey(targetView)) { @@ -300,9 +300,9 @@ namespace Tizen.NUI /// Removes listener for drop targets /// /// The target window - /// The callback function to remove + /// The callback function to remove(Not used) [EditorBrowsable(EditorBrowsableState.Never)] - public void RemoveListener(Window targetWindow, DragAndDropWindowEventHandler callback) + public void RemoveListener(Window targetWindow, DragAndDropWindowEventHandler _) { if (!targetWindowEventDictionary.ContainsKey(targetWindow)) { diff --git a/src/Tizen.NUI/src/public/Images/ImageUrl.cs b/src/Tizen.NUI/src/public/Images/ImageUrl.cs index 120803c30..e68c71380 100644 --- a/src/Tizen.NUI/src/public/Images/ImageUrl.cs +++ b/src/Tizen.NUI/src/public/Images/ImageUrl.cs @@ -66,6 +66,7 @@ namespace Tizen.NUI } [EditorBrowsable(EditorBrowsableState.Never)] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1065: Do not raise exceptions in unexpected locations")] public override string ToString() { string ret = Interop.ImageUrl.GetUrl(SwigCPtr); diff --git a/src/Tizen.NUI/src/public/Images/PixelData.cs b/src/Tizen.NUI/src/public/Images/PixelData.cs index 9f915ad4b..fc824ab82 100755 --- a/src/Tizen.NUI/src/public/Images/PixelData.cs +++ b/src/Tizen.NUI/src/public/Images/PixelData.cs @@ -45,11 +45,12 @@ namespace Tizen.NUI /// Buffer width in pixels. /// Buffer height in pixels. /// The pixel format. - /// The function used to release the memory. + /// Not used parameter. /// 5 /// This will be deprecated after API level 9. ReleaseFunction is not useful in C#. [EditorBrowsable(EditorBrowsableState.Never)] - public PixelData(byte[] buffer, uint bufferSize, uint width, uint height, PixelFormat pixelFormat, PixelData.ReleaseFunction releaseFunction) : this(Interop.PixelData.New(buffer, bufferSize, width, height, (int)pixelFormat), true) + [Obsolete("Do not use this constructor. Use PixelData(byte[], uint, uint, uint, PixelFormat).")] + public PixelData(byte[] buffer, uint bufferSize, uint width, uint height, PixelFormat pixelFormat, PixelData.ReleaseFunction _) : this(Interop.PixelData.New(buffer, bufferSize, width, height, (int)pixelFormat), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); diff --git a/src/Tizen.NUI/src/public/Images/PixelFormat.cs b/src/Tizen.NUI/src/public/Images/PixelFormat.cs index d9392cd87..9e2754c68 100755 --- a/src/Tizen.NUI/src/public/Images/PixelFormat.cs +++ b/src/Tizen.NUI/src/public/Images/PixelFormat.cs @@ -21,7 +21,8 @@ namespace Tizen.NUI /// Enumeration for Pixel formats.
/// Pixel format, default color depth is RGBA 32 bit with alpha. /// - /// /// 3 + /// 3 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707: Identifiers should not contain underscores")] public enum PixelFormat { /// diff --git a/src/Tizen.NUI/src/public/Rendering/VertexBuffer.cs b/src/Tizen.NUI/src/public/Rendering/VertexBuffer.cs index 25dd5d2d1..3e8542a31 100755 --- a/src/Tizen.NUI/src/public/Rendering/VertexBuffer.cs +++ b/src/Tizen.NUI/src/public/Rendering/VertexBuffer.cs @@ -52,7 +52,7 @@ namespace Tizen.NUI /// Thrown when vertices is null or length of the vertices is 0. /// Thrown when length of the vertices is overflow. /// 8 - + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1715: Identifiers should have correct prefix")] public void SetData(VertexType[] vertices) where VertexType : struct { if (null == vertices || vertices.Length == 0) diff --git a/src/Tizen.NUI/src/public/Theme/ThemeManager.cs b/src/Tizen.NUI/src/public/Theme/ThemeManager.cs index 9c3ae1201..df6cddfa9 100755 --- a/src/Tizen.NUI/src/public/Theme/ThemeManager.cs +++ b/src/Tizen.NUI/src/public/Theme/ThemeManager.cs @@ -36,7 +36,9 @@ namespace Tizen.NUI /// /// /// 9 +#pragma warning disable CA1724 public static class ThemeManager +#pragma warning restore CA1724 { /// /// The default light theme name preloaded in platform. diff --git a/src/Tizen.NUI/src/public/Utility/Capture.cs b/src/Tizen.NUI/src/public/Utility/Capture.cs index 9bd506b0d..d74d7a71b 100755 --- a/src/Tizen.NUI/src/public/Utility/Capture.cs +++ b/src/Tizen.NUI/src/public/Utility/Capture.cs @@ -139,7 +139,7 @@ namespace Tizen.NUI } else if (null == path) { - throw new ArgumentNullException("path should not be null"); + throw new ArgumentNullException(nameof(path), "path should not be null"); } else if (null == position) { @@ -183,7 +183,7 @@ namespace Tizen.NUI } else if (null == path) { - throw new ArgumentNullException("path should not be null"); + throw new ArgumentNullException(nameof(path), "path should not be null"); } else if (quality > 100) { @@ -226,7 +226,7 @@ namespace Tizen.NUI } else if (null == path) { - throw new ArgumentNullException("path should not be null"); + throw new ArgumentNullException(nameof(path), "path should not be null"); } else if (null == color) { @@ -267,7 +267,7 @@ namespace Tizen.NUI } else if (null == path) { - throw new ArgumentNullException("path should not be null"); + throw new ArgumentNullException(nameof(path), "path should not be null"); } if (source is View || source is Layer) diff --git a/src/Tizen.NUI/src/public/Utility/RenderEffect.cs b/src/Tizen.NUI/src/public/Utility/RenderEffect.cs index 9ff734f2d..cd409bdb9 100644 --- a/src/Tizen.NUI/src/public/Utility/RenderEffect.cs +++ b/src/Tizen.NUI/src/public/Utility/RenderEffect.cs @@ -60,6 +60,7 @@ namespace Tizen.NUI /// /// RenderEffect.CreateBackgroundBlurEffect(blurRadius); /// + /// [EditorBrowsable(EditorBrowsableState.Never)] sealed class BackgroundBlurEffect : RenderEffect {