From 20b3ef4a5fe14a3404356656aa3827b938bd89e7 Mon Sep 17 00:00:00 2001 From: JoogabYun <40262755+JoogabYun@users.noreply.github.com> Date: Tue, 17 Nov 2020 10:15:32 +0900 Subject: [PATCH] [NUI] fixed build warning CA2208 (#2228) --- src/Tizen.NUI/src/internal/EnumHelper.cs | 2 +- src/Tizen.NUI/src/internal/Xaml/CreateValuesVisitor.cs | 4 ++-- src/Tizen.NUI/src/internal/Xaml/ExpandMarkupsVisitor.cs | 4 ++-- src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs | 4 ++-- src/Tizen.NUI/src/public/BaseComponents/TextField.cs | 4 ++-- src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs | 2 +- src/Tizen.NUI/src/public/FocusManager.cs | 2 +- src/Tizen.NUI/src/public/Xaml/StaticResourceExtension.cs | 4 ++-- src/Tizen.NUI/src/public/Xaml/XamlServiceProvider.cs | 6 +++--- src/Tizen.NUI/src/public/XamlBinding/BindingBase.cs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Tizen.NUI/src/internal/EnumHelper.cs b/src/Tizen.NUI/src/internal/EnumHelper.cs index 67fea42..bfef6f3 100755 --- a/src/Tizen.NUI/src/internal/EnumHelper.cs +++ b/src/Tizen.NUI/src/internal/EnumHelper.cs @@ -90,7 +90,7 @@ namespace Tizen.NUI return result; } - throw new ArgumentException($"{value} can't be found.", "Value"); + throw new ArgumentException($"{value} can't be found.", nameof(value)); } } } diff --git a/src/Tizen.NUI/src/internal/Xaml/CreateValuesVisitor.cs b/src/Tizen.NUI/src/internal/Xaml/CreateValuesVisitor.cs index 9a2106c..9b8f3bc 100755 --- a/src/Tizen.NUI/src/internal/Xaml/CreateValuesVisitor.cs +++ b/src/Tizen.NUI/src/internal/Xaml/CreateValuesVisitor.cs @@ -48,7 +48,7 @@ namespace Tizen.NUI.Xaml var type = XamlParser.GetElementType(node.XmlType, node, Context.RootElement?.GetType().GetTypeInfo().Assembly, out xpe); if (type == null) - throw new ArgumentNullException(nameof(type)); + throw new ArgumentNullException(null, "type should not be null"); if (xpe != null) throw xpe; @@ -140,7 +140,7 @@ namespace Tizen.NUI.Xaml INode xKey; if (!node.Properties.TryGetValue(XmlName.xKey, out xKey)) xKey = null; - + node.Properties.Clear(); node.CollectionItems.Clear(); diff --git a/src/Tizen.NUI/src/internal/Xaml/ExpandMarkupsVisitor.cs b/src/Tizen.NUI/src/internal/Xaml/ExpandMarkupsVisitor.cs index 308e9e2..c10a85f 100755 --- a/src/Tizen.NUI/src/internal/Xaml/ExpandMarkupsVisitor.cs +++ b/src/Tizen.NUI/src/internal/Xaml/ExpandMarkupsVisitor.cs @@ -108,7 +108,7 @@ namespace Tizen.NUI.Xaml { var nsResolver = serviceProvider.GetService(typeof (IXmlNamespaceResolver)) as IXmlNamespaceResolver; if (nsResolver == null) - throw new ArgumentException(); + throw new ArgumentException(nameof(nsResolver)); IXmlLineInfo xmlLineInfo = null; var xmlLineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider; if (xmlLineInfoProvider != null) @@ -116,7 +116,7 @@ namespace Tizen.NUI.Xaml var split = match.Split(':'); if (split.Length > 2) - throw new ArgumentException(); + throw new ArgumentException(nameof(split.Length)); string prefix; //, name; if (split.Length == 2) diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index c664e09..674ec53 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -92,7 +92,7 @@ namespace Tizen.NUI.BaseComponents { if (NUIApplication.MultilingualResourceManager == null) { - throw new ArgumentNullException("ResourceManager about multilingual is null"); + throw new ArgumentNullException(null, "ResourceManager about multilingual is null"); } textEditorTextSid = value; Text = SetTranslatable(textEditorTextSid); @@ -117,7 +117,7 @@ namespace Tizen.NUI.BaseComponents { if (NUIApplication.MultilingualResourceManager == null) { - throw new ArgumentNullException("ResourceManager about multilingual is null"); + throw new ArgumentNullException(null, "ResourceManager about multilingual is null"); } textEditorPlaceHolderTextSid = value; PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid); diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs index d74b284..e718e8d 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -136,7 +136,7 @@ namespace Tizen.NUI.BaseComponents { if (NUIApplication.MultilingualResourceManager == null) { - throw new ArgumentNullException("ResourceManager about multilingual is null"); + throw new ArgumentNullException(null, "ResourceManager about multilingual is null"); } textFieldTextSid = value; Text = SetTranslatable(textFieldTextSid); @@ -174,7 +174,7 @@ namespace Tizen.NUI.BaseComponents { if (NUIApplication.MultilingualResourceManager == null) { - throw new ArgumentNullException("ResourceManager about multilingual is null"); + throw new ArgumentNullException(null, "ResourceManager about multilingual is null"); } textFieldPlaceHolderTextSid = value; PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid); diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index 00f0939..be8ce34 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -201,7 +201,7 @@ namespace Tizen.NUI.BaseComponents { if (NUIApplication.MultilingualResourceManager == null) { - throw new ArgumentNullException("ResourceManager about multilingual is null"); + throw new ArgumentNullException(null, "ResourceManager about multilingual is null"); } string translatableText = null; textLabelSid = value; diff --git a/src/Tizen.NUI/src/public/FocusManager.cs b/src/Tizen.NUI/src/public/FocusManager.cs index 33e146f..f600b7c 100755 --- a/src/Tizen.NUI/src/public/FocusManager.cs +++ b/src/Tizen.NUI/src/public/FocusManager.cs @@ -293,7 +293,7 @@ namespace Tizen.NUI { if (view == null) { - throw new ArgumentNullException("the target view should not be null"); + throw new ArgumentNullException(nameof(view), "the target view should not be null"); } bool ret = Interop.FocusManager.FocusManager_SetCurrentFocusActor(swigCPtr, View.getCPtr(view)); diff --git a/src/Tizen.NUI/src/public/Xaml/StaticResourceExtension.cs b/src/Tizen.NUI/src/public/Xaml/StaticResourceExtension.cs index b531909..0954444 100755 --- a/src/Tizen.NUI/src/public/Xaml/StaticResourceExtension.cs +++ b/src/Tizen.NUI/src/public/Xaml/StaticResourceExtension.cs @@ -29,7 +29,7 @@ namespace Tizen.NUI.Xaml } var valueProvider = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideParentValues; if (valueProvider == null) - throw new ArgumentException(); + throw new ArgumentException(nameof(valueProvider)); var xmlLineInfoProvider = serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider; var xmlLineInfo = xmlLineInfoProvider != null ? xmlLineInfoProvider.XmlLineInfo : null; object resource = null; @@ -66,7 +66,7 @@ namespace Tizen.NUI.Xaml if (implicit_op != null) return implicit_op.Invoke(resource, new [] { resource }); - if (resource != null) { + if (resource != null) { //Special case for https://bugzilla.xamarin.com/show_bug.cgi?id=59818 //On OnPlatform, check for an opImplicit from the targetType if ( Device.Flags != null diff --git a/src/Tizen.NUI/src/public/Xaml/XamlServiceProvider.cs b/src/Tizen.NUI/src/public/Xaml/XamlServiceProvider.cs index aee0c33..deea062 100755 --- a/src/Tizen.NUI/src/public/Xaml/XamlServiceProvider.cs +++ b/src/Tizen.NUI/src/public/Xaml/XamlServiceProvider.cs @@ -159,7 +159,7 @@ namespace Tizen.NUI.Xaml if (objectAndParents == null) throw new ArgumentNullException(nameof(objectAndParents)); if (objectAndParents.Length == 0) - throw new ArgumentException(); + throw new ArgumentException(nameof(objectAndParents.Length)); this.objectAndParents = objectAndParents; this.targetProperty = targetProperty; @@ -211,9 +211,9 @@ namespace Tizen.NUI.Xaml { this.currentAssembly = currentAssembly; if (namespaceResolver == null) - throw new ArgumentNullException(); + throw new ArgumentNullException(nameof(namespaceResolver)); if (getTypeFromXmlName == null) - throw new ArgumentNullException(); + throw new ArgumentNullException(nameof(getTypeFromXmlName)); this.namespaceResolver = namespaceResolver; this.getTypeFromXmlName = getTypeFromXmlName; diff --git a/src/Tizen.NUI/src/public/XamlBinding/BindingBase.cs b/src/Tizen.NUI/src/public/XamlBinding/BindingBase.cs index 3f6e28d..d4ba72d 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/BindingBase.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/BindingBase.cs @@ -37,7 +37,7 @@ namespace Tizen.NUI.Binding && value != BindingMode.OneWayToSource && value != BindingMode.TwoWay && value != BindingMode.OneTime) - throw new ArgumentException("mode is not a valid BindingMode", "mode"); + throw new ArgumentException("mode is not a valid BindingMode", nameof(Mode)); ThrowIfApplied(); -- 2.7.4