From 2ffb4a37eb4e34ede106cffa1497f7de9b5ec802 Mon Sep 17 00:00:00 2001 From: Seoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com> Date: Mon, 23 Nov 2020 15:23:03 +0900 Subject: [PATCH] [NUI] Fix build warning CA1062 (#2234) * [NUI] Fix build warning CA1062 - Need to verify whether the argument is null https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1062 Signed-off-by: Seoyeon Kim * [NUI] Add exception handling tag - The tag lets you specify which exceptions can be thrown. Signed-off-by: Seoyeon Kim --- src/Tizen.NUI/src/internal/Camera.cs | 4 ++ src/Tizen.NUI/src/internal/ItemContainer.cs | 2 +- src/Tizen.NUI/src/internal/ItemIdContainer.cs | 2 +- src/Tizen.NUI/src/internal/RenderTask.cs | 4 ++ src/Tizen.NUI/src/public/Animation.cs | 51 ++++++++++++++++++ .../src/public/BaseComponents/ControlState.cs | 10 ++++ .../src/public/BaseComponents/ImageView.cs | 11 ++++ .../public/BaseComponents/LottieAnimationView.cs | 4 +- .../src/public/BaseComponents/Style/Selector.cs | 27 +++++++++- .../src/public/BaseComponents/TextLabel.cs | 6 ++- src/Tizen.NUI/src/public/BaseComponents/View.cs | 11 ++++ .../src/public/BaseComponents/ViewInternal.cs | 7 ++- .../src/public/BaseComponents/ViewPublicMethods.cs | 2 +- .../src/public/BaseComponents/VisualView.cs | 23 ++++++++ src/Tizen.NUI/src/public/Capture.cs | 48 ++++++++++++++--- src/Tizen.NUI/src/public/Color.cs | 51 ++++++++++++++++-- src/Tizen.NUI/src/public/CustomView/Spin.cs | 5 +- src/Tizen.NUI/src/public/CustomViewRegistry.cs | 6 +++ src/Tizen.NUI/src/public/Extents.cs | 5 ++ src/Tizen.NUI/src/public/GLWindow.cs | 12 +++++ src/Tizen.NUI/src/public/GraphicsTypeConverter.cs | 27 +++++----- src/Tizen.NUI/src/public/ImageLoading.cs | 61 ++++++++++++++++++++++ src/Tizen.NUI/src/public/KeyValue.cs | 6 +++ src/Tizen.NUI/src/public/Layer.cs | 17 ++++++ src/Tizen.NUI/src/public/Layouting/FlexLayout.cs | 5 ++ src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs | 20 ++++++- .../src/public/NUIComponentApplication.cs | 7 ++- src/Tizen.NUI/src/public/Position.cs | 20 +++---- src/Tizen.NUI/src/public/Position2D.cs | 20 +++---- src/Tizen.NUI/src/public/PropertyArray.cs | 5 ++ src/Tizen.NUI/src/public/PropertyMap.cs | 5 ++ src/Tizen.NUI/src/public/PropertyNotification.cs | 5 ++ src/Tizen.NUI/src/public/PropertyValue.cs | 7 ++- src/Tizen.NUI/src/public/RelativeVector2.cs | 16 +++--- src/Tizen.NUI/src/public/RelativeVector3.cs | 12 ++--- src/Tizen.NUI/src/public/RelativeVector4.cs | 16 +++--- src/Tizen.NUI/src/public/Rotation.cs | 16 +++--- src/Tizen.NUI/src/public/Size.cs | 20 +++---- src/Tizen.NUI/src/public/Size2D.cs | 20 +++---- src/Tizen.NUI/src/public/UIComponents/Slider.cs | 5 ++ src/Tizen.NUI/src/public/Vector2.cs | 16 +++--- src/Tizen.NUI/src/public/Vector3.cs | 14 ++--- src/Tizen.NUI/src/public/Vector4.cs | 14 ++--- src/Tizen.NUI/src/public/VertexBuffer.cs | 6 +++ .../src/public/ViewProperty/ImageShadow.cs | 2 +- src/Tizen.NUI/src/public/ViewProperty/Shadow.cs | 2 +- .../src/public/ViewProperty/ShadowBase.cs | 2 +- src/Tizen.NUI/src/public/WidgetViewManager.cs | 2 +- src/Tizen.NUI/src/public/Window.cs | 37 +++++++++++-- .../src/public/XamlBinding/BindableObject.cs | 11 ++++ .../src/public/XamlBinding/ColorTypeConverter.cs | 8 ++- src/Tizen.NUI/src/public/XamlBinding/Element.cs | 16 +++++- .../src/public/XamlBinding/Internals/NameScope.cs | 7 ++- .../src/public/XamlBinding/SizeTypeConverter.cs | 16 ++++-- src/Tizen.NUI/src/public/XamlBinding/Transition.cs | 4 +- 55 files changed, 610 insertions(+), 148 deletions(-) diff --git a/src/Tizen.NUI/src/internal/Camera.cs b/src/Tizen.NUI/src/internal/Camera.cs index ef68537..8b7b9bb 100755 --- a/src/Tizen.NUI/src/internal/Camera.cs +++ b/src/Tizen.NUI/src/internal/Camera.cs @@ -69,6 +69,10 @@ namespace Tizen.NUI public static Camera DownCast(BaseHandle handle) { + if (handle == null) + { + throw new global::System.ArgumentNullException(nameof(handle)); + } Camera ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Camera; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/internal/ItemContainer.cs b/src/Tizen.NUI/src/internal/ItemContainer.cs index 3bf852f..62544a1 100755 --- a/src/Tizen.NUI/src/internal/ItemContainer.cs +++ b/src/Tizen.NUI/src/internal/ItemContainer.cs @@ -197,7 +197,7 @@ namespace Tizen.NUI collectionRef = collection; currentIndex = -1; currentObject = null; - currentSize = collectionRef.Count; + currentSize = collectionRef?.Count ?? 0; } // Type-safe iterator Current diff --git a/src/Tizen.NUI/src/internal/ItemIdContainer.cs b/src/Tizen.NUI/src/internal/ItemIdContainer.cs index 33ac295..b7e47bd 100755 --- a/src/Tizen.NUI/src/internal/ItemIdContainer.cs +++ b/src/Tizen.NUI/src/internal/ItemIdContainer.cs @@ -196,7 +196,7 @@ namespace Tizen.NUI collectionRef = collection; currentIndex = -1; currentObject = null; - currentSize = collectionRef.Count; + currentSize = collectionRef?.Count ?? 0; } // Type-safe iterator Current diff --git a/src/Tizen.NUI/src/internal/RenderTask.cs b/src/Tizen.NUI/src/internal/RenderTask.cs index 7f62c63..c6dec1e 100755 --- a/src/Tizen.NUI/src/internal/RenderTask.cs +++ b/src/Tizen.NUI/src/internal/RenderTask.cs @@ -152,6 +152,10 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public static RenderTask DownCast(BaseHandle handle) { + if (handle == null) + { + throw new global::System.ArgumentNullException(nameof(handle)); + } RenderTask ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as RenderTask; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/Animation.cs b/src/Tizen.NUI/src/public/Animation.cs index 099dd27..d5c1c6f 100755 --- a/src/Tizen.NUI/src/public/Animation.cs +++ b/src/Tizen.NUI/src/public/Animation.cs @@ -506,11 +506,16 @@ namespace Tizen.NUI /// /// Handle to an object. /// Handle to an animation object or an uninitialized handle. + /// Thrown when handle is null. /// 3 [Obsolete("Deprecated in API6, Will be removed in API9, Please use as keyword instead!")] [EditorBrowsable(EditorBrowsableState.Never)] public static Animation DownCast(BaseHandle handle) { + if (handle == null) + { + throw new ArgumentNullException(nameof(handle)); + } Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -535,9 +540,19 @@ namespace Tizen.NUI /// The target property to animate. /// The property value will change by this amount. /// The alpha function to apply. + /// Thrown when target or relativeValue is null. /// 3 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null) { + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + else if (relativeValue == null) + { + throw new ArgumentNullException(nameof(relativeValue)); + } + Property _prop = PropertyHelper.GetPropertyFromString(target, property); relativeValue = AvoidFloatPropertyHasIntegerValue(target, _prop, relativeValue); PropertyValue val = PropertyValue.CreateFromObject(relativeValue); @@ -561,9 +576,19 @@ namespace Tizen.NUI /// The start time of the animation. /// The end time of the animation. /// The alpha function to apply. + /// Thrown when target or relativeValue is null. /// 3 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null) { + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + else if (relativeValue == null) + { + throw new ArgumentNullException(nameof(relativeValue)); + } + Property _prop = PropertyHelper.GetPropertyFromString(target, property); relativeValue = AvoidFloatPropertyHasIntegerValue(target, _prop, relativeValue); PropertyValue val = PropertyValue.CreateFromObject(relativeValue); @@ -587,9 +612,19 @@ namespace Tizen.NUI /// The target property to animate. /// The destination value. /// The alpha function to apply. + /// Thrown when target or destinationValue is null. /// 3 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null) { + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + else if (destinationValue == null) + { + throw new ArgumentNullException(nameof(destinationValue)); + } + Property _prop = PropertyHelper.GetPropertyFromString(target, property); destinationValue = AvoidFloatPropertyHasIntegerValue(target, _prop, destinationValue); PropertyValue val = PropertyValue.CreateFromObject(destinationValue); @@ -608,8 +643,14 @@ namespace Tizen.NUI /// Animates one or more properties to a destination value.
/// /// The target object to animate. + /// Thrown when target is null. public void PlayAnimateTo(View target) { + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + Clear(); if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length) { @@ -643,9 +684,19 @@ namespace Tizen.NUI /// The start time of the animation. /// The end time of the animation. /// The alpha function to apply. + /// Thrown when target or destinationValue is null. /// 3 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null) { + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + else if (destinationValue == null) + { + throw new ArgumentNullException(nameof(destinationValue)); + } + Property _prop = PropertyHelper.GetPropertyFromString(target, property); destinationValue = AvoidFloatPropertyHasIntegerValue(target, _prop, destinationValue); PropertyValue val = PropertyValue.CreateFromObject(destinationValue); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ControlState.cs b/src/Tizen.NUI/src/public/BaseComponents/ControlState.cs index 5d26cfb..14a7de2 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ControlState.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ControlState.cs @@ -268,9 +268,19 @@ namespace Tizen.NUI.BaseComponents /// A on the left hand side. /// A on the right hand side. /// The containing the result of the substraction. + /// Thrown when lhs or rhs is null. [EditorBrowsable(EditorBrowsableState.Never)] public static ControlState operator -(ControlState lhs, ControlState rhs) { + if (null == lhs) + { + throw new ArgumentNullException(nameof(lhs)); + } + else if (null == rhs) + { + throw new ArgumentNullException(nameof(rhs)); + } + if (!lhs.IsCombined) { return ReferenceEquals(lhs, rhs) ? Normal : lhs; diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 19eea4e..d31994a 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -655,6 +655,7 @@ namespace Tizen.NUI.BaseComponents /// /// Downcasts a handle to imageView handle. /// + /// Thrown when handle is null. /// Please do not use! this will be deprecated! /// Instead please use as keyword. /// 3 @@ -665,6 +666,10 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public static ImageView DownCast(BaseHandle handle) { + if (null == handle) + { + throw new ArgumentNullException(nameof(handle)); + } ImageView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as ImageView; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -675,9 +680,15 @@ namespace Tizen.NUI.BaseComponents /// If the URL is empty, ImageView will not display anything.
/// /// The URL to the image resource to display. + /// Thrown when url is null. /// 3 public void SetImage(string url) { + if (null == url) + { + throw new ArgumentNullException(nameof(url)); + } + if (url.Contains(".json")) { Tizen.Log.Fatal("NUI", "[ERROR] Please DO NOT set lottie file in ImageView! This is temporary checking, will be removed soon!"); diff --git a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs index 3876139..4ebe19b 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs @@ -303,7 +303,7 @@ namespace Tizen.NUI.BaseComponents } /// - /// Sets or gets the loop count. + /// Sets or gets the loop count. /// /// /// The minus value means the infinite loop count. @@ -514,7 +514,7 @@ namespace Tizen.NUI.BaseComponents } /// - /// A marker has its start frame and end frame. + /// A marker has its start frame and end frame. /// Animation will play between the start frame and the end frame of the marker if one marker is specified. /// Or animation will play between the start frame of the first marker and the end frame of the second marker if two markers are specified. * /// diff --git a/src/Tizen.NUI/src/public/BaseComponents/Style/Selector.cs b/src/Tizen.NUI/src/public/BaseComponents/Style/Selector.cs index 6f64793..07baed1 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/Style/Selector.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/Style/Selector.cs @@ -212,6 +212,7 @@ namespace Tizen.NUI.BaseComponents /// /// Get value by State. /// + /// Thrown when state is null. /// 6 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. /// True if the selector has a given state value, false otherwise. @@ -234,6 +235,10 @@ namespace Tizen.NUI.BaseComponents return true; } + if (null == state) + { + throw new ArgumentNullException(nameof(state)); + } if (state.IsCombined) { index = ((List>)StateValueList).FindIndex(x => state.Contains(x.State)); @@ -295,9 +300,15 @@ namespace Tizen.NUI.BaseComponents /// /// Copy values from other selector. /// + /// Thrown when other is null. [EditorBrowsable(EditorBrowsableState.Never)] public void Clone(Selector other) { + if (null == other) + { + throw new ArgumentNullException(nameof(other)); + } + if (cloneable) { All = (T)((ICloneable)other.All)?.Clone(); @@ -349,10 +360,15 @@ namespace Tizen.NUI.BaseComponents /// /// Return the containing selector. It can be null. /// + /// Thrown when view is null. [EditorBrowsable(EditorBrowsableState.Never)] public Selector Get(View view) { if (!dirty) return selector; + if (null == view) + { + throw new ArgumentNullException(nameof(view)); + } T value = default; @@ -377,11 +393,17 @@ namespace Tizen.NUI.BaseComponents /// The View that is affected by this TriggerableSelector. /// The copy target. /// Whether it updates the target view after update the selector or not. + /// Thrown when view is null. [EditorBrowsable(EditorBrowsableState.Never)] public void Update(View view, Selector otherSelector, bool updateView = false) { Reset(view); + if (null == view) + { + throw new ArgumentNullException(nameof(view)); + } + if (otherSelector == null) { return; @@ -427,7 +449,10 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public void Reset(View view) { - view.ControlStateChangeEventInternal -= OnViewControlState; + if (view != null) + { + view.ControlStateChangeEventInternal -= OnViewControlState; + } selector?.Clear(); selector = null; dirty = false; diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index 10d2492..d3c9486 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -945,6 +945,7 @@ namespace Tizen.NUI.BaseComponents /// /// /// + /// Thrown when handle is null. /// 3 /// Please do not use! this will be deprecated! /// Instead please use as keyword. @@ -955,8 +956,11 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public static TextLabel DownCast(BaseHandle handle) { + if (null == handle) + { + throw new ArgumentNullException(nameof(handle)); + } TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel; - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 21b8008..ef97a6d 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -1684,6 +1684,7 @@ namespace Tizen.NUI.BaseComponents /// /// Gets or sets the minimum size the view can be assigned in size negotiation. /// + /// Thrown when value is null. /// /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible. /// @@ -1697,6 +1698,10 @@ namespace Tizen.NUI.BaseComponents } set { + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } if (_layout != null) { // Note: it only works if minimum size is >= than natural size. @@ -2040,6 +2045,7 @@ namespace Tizen.NUI.BaseComponents /// /// Set a layout transitions for this View. /// + /// Thrown when value is null. /// /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View. /// @@ -2048,10 +2054,15 @@ namespace Tizen.NUI.BaseComponents { set { + if (value == null) + { + throw new global::System.ArgumentNullException(nameof(value)); + } if (_layoutTransitions == null) { _layoutTransitions = new Dictionary(); } + LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions, value.Condition, value, true); AttachTransitionsToChildren(value); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index bd71b42..a63b08c 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -1167,9 +1167,15 @@ namespace Tizen.NUI.BaseComponents /// The touch event handler for ControlState. /// Please change ControlState value by touch state if needed. /// + /// Thrown when touch is null. [EditorBrowsable(EditorBrowsableState.Never)] protected virtual bool HandleControlStateOnTouch(Touch touch) { + if (touch == null) + { + throw new global::System.ArgumentNullException(nameof(touch)); + } + switch (touch.GetState(0)) { case PointStateType.Down: @@ -1185,7 +1191,6 @@ namespace Tizen.NUI.BaseComponents default: break; } - return false; } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs index 7871280..6467155 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs @@ -162,7 +162,7 @@ namespace Tizen.NUI.BaseComponents /// 4 public override void Remove(View child) { - if (!child || child.GetParent() == null) // Early out if child null. + if (child == null || child.GetParent() == null) // Early out if child null. return; bool hasLayout = (_layout != null); diff --git a/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs index e81b6ba..1746de3 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs @@ -114,6 +114,7 @@ namespace Tizen.NUI.BaseComponents /// /// The name of a visual to add. If a name is added to an existing visual name, the visual will be replaced. /// The property map of a visual to create. + /// Thrown when visualMap is null. /// 3 public void AddVisual(string visualName, VisualMap visualMap) { @@ -142,6 +143,10 @@ namespace Tizen.NUI.BaseComponents if (visualIndex > 0) { + if (visualMap == null) + { + throw new ArgumentNullException(nameof(visualMap)); + } visual = VisualFactory.Instance.CreateVisual(visualMap.OutputVisualMap); // Create a visual for the new one. visual.Name = visualName; visual.DepthIndex = visualMap.DepthIndex; @@ -227,9 +232,15 @@ namespace Tizen.NUI.BaseComponents /// The alpha function of visual animation. /// The initial property value of visual animation. /// Animation instance + /// Thrown when target is null. /// 3 public Animation AnimateVisual(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialValue = null) { + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + string _alphaFunction = alphaFunction?.GetDescription(); foreach (var item in _visualDictionary.ToList()) @@ -279,9 +290,15 @@ namespace Tizen.NUI.BaseComponents /// The end time of visual animation. /// The alpha function of visual animation. /// The initial property value of visual animation. + /// Thrown when target is null. /// 3 public void AnimateVisualAdd(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialValue = null) { + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + string _alphaFunction = alphaFunction?.GetDescription(); foreach (var item in _visualDictionary.ToList()) @@ -339,9 +356,15 @@ namespace Tizen.NUI.BaseComponents /// /// temporary fix to pass TCT. /// + /// Thrown when visualMap is null. /// 3 public Animation VisualAnimate(Tizen.NUI.VisualAnimator visualMap) { + if (visualMap == null) + { + throw new ArgumentNullException(nameof(visualMap)); + } + foreach (var item in _visualDictionary.ToList()) { if (item.Value.Name == visualMap.Target) diff --git a/src/Tizen.NUI/src/public/Capture.cs b/src/Tizen.NUI/src/public/Capture.cs index 2dee58a..c31514a 100755 --- a/src/Tizen.NUI/src/public/Capture.cs +++ b/src/Tizen.NUI/src/public/Capture.cs @@ -105,11 +105,15 @@ namespace Tizen.NUI /// If path is empty string, the captured result is not be saved as a file. /// background color of captured scene. /// This exception can be due to the invalid size values, of when width or height is lower than zero. - /// This exception is due to the path is null. + /// This exception is thrown when size or path or position or color is null. [EditorBrowsable(EditorBrowsableState.Never)] public void Start(Container source, Position position, Size size, string path, Color color) { - if (size.Width <= 0 || size.Height <= 0) + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } + else if (size.Width <= 0 || size.Height <= 0) { throw new InvalidOperationException("size should larger than zero"); } @@ -117,6 +121,14 @@ namespace Tizen.NUI { throw new ArgumentNullException("path should not be null"); } + else if (null == position) + { + throw new ArgumentNullException(nameof(position)); + } + else if (null == color) + { + throw new ArgumentNullException(nameof(color)); + } if (source is View || source is Layer) { @@ -137,11 +149,15 @@ namespace Tizen.NUI /// background color of captured scene. /// The value to control image quality for jpeg file format in the range [1, 100]. /// This exception can be due to the invalid size values, of when width or height is lower than zero. - /// This exception is due to the path is null. + /// This exception is thrown when size or path or color is null. [EditorBrowsable(EditorBrowsableState.Never)] public void Start(Container source, Size size, string path, Color color, uint quality) { - if (size.Width <= 0 || size.Height <= 0) + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } + else if (size.Width <= 0 || size.Height <= 0) { throw new InvalidOperationException("size should larger than zero"); } @@ -153,6 +169,10 @@ namespace Tizen.NUI { throw new InvalidOperationException("quality should between 0 to 100"); } + else if (null == color) + { + throw new ArgumentNullException(nameof(color)); + } if (source is View || source is Layer) { @@ -172,11 +192,15 @@ namespace Tizen.NUI /// If path is empty string, the captured result is not be saved as a file. /// background color of captured scene. /// This exception can be due to the invalid size values, of when width or height is lower than zero. - /// This exception is due to the path is null. + /// This exception is thrown when size or path or color is null. [EditorBrowsable(EditorBrowsableState.Never)] public void Start(Container source, Size size, string path, Color color) { - if (size.Width <= 0 || size.Height <= 0) + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } + else if (size.Width <= 0 || size.Height <= 0) { throw new InvalidOperationException("size should larger than zero"); } @@ -184,6 +208,10 @@ namespace Tizen.NUI { throw new ArgumentNullException("path should not be null"); } + else if (null == color) + { + throw new ArgumentNullException(nameof(color)); + } if (source is View || source is Layer) { @@ -205,11 +233,15 @@ namespace Tizen.NUI /// image file path to be saved as a file. /// If path is empty string, the captured result is not be saved as a file. /// This exception can be due to the invalid size values, of when width or height is lower than zero. - /// This exception is due to the path is null. + /// This exception is thrown when size or path is null. [EditorBrowsable(EditorBrowsableState.Never)] public void Start(Container source, Size size, string path) { - if (size.Width <= 0 || size.Height <= 0) + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } + else if (size.Width <= 0 || size.Height <= 0) { throw new InvalidOperationException("size should larger than zero"); } diff --git a/src/Tizen.NUI/src/public/Color.cs b/src/Tizen.NUI/src/public/Color.cs index 55a3596..84e110d 100755 --- a/src/Tizen.NUI/src/public/Color.cs +++ b/src/Tizen.NUI/src/public/Color.cs @@ -121,6 +121,7 @@ namespace Tizen.NUI /// The conversion constructor from an hexcode of four floats. /// /// Hex color code + /// This exception is thrown when hexColor is null. /// 6 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] @@ -128,6 +129,10 @@ namespace Tizen.NUI { try { + if (null == hexColor) + { + throw new ArgumentNullException(nameof(hexColor)); + } hexColor = hexColor.Replace("#", ""); R = ((float)Convert.ToInt32(hexColor.Substring(0, 2), 16)) / 255.0f; @@ -159,7 +164,7 @@ namespace Tizen.NUI /// /// The copy target. [EditorBrowsable(EditorBrowsableState.Never)] - public Color(Color other) : this(other.R, other.G, other.B, other.A) + public Color(Color other) : this((float)other?.R, (float)other.G, (float)other.B, (float)other.A) { } @@ -294,7 +299,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Vector4(Color color) { - return new Vector4(color.R, color.G, color.B, color.A); + return new Vector4((float)color?.R, (float)color.G, (float)color.B, (float)color.A); } /// @@ -304,7 +309,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Color(Vector4 vec) { - return new Color(vec.R, vec.G, vec.B, vec.A); + return new Color((float)vec?.R, (float)vec.G, (float)vec.B, (float)vec.A); } /// @@ -313,9 +318,14 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The color containing the result of the addition. + /// Thrown when arg1 is null. /// 3 public static Color operator +(Color arg1, Color arg2) { + if (null == arg1) + { + throw new ArgumentNullException(nameof(arg1)); + } Color result = arg1.Add(arg2); return ValueCheck(result); } @@ -326,9 +336,14 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The color containing the result of the subtraction. + /// Thrown when arg1 is null. /// 3 public static Color operator -(Color arg1, Color arg2) { + if (null == arg1) + { + throw new ArgumentNullException(nameof(arg1)); + } Color result = arg1.Subtract(arg2); return ValueCheck(result); } @@ -338,9 +353,14 @@ namespace Tizen.NUI /// /// The target value. /// The color containg the negation. + /// Thrown when arg1 is null. /// 3 public static Color operator -(Color arg1) { + if (null == arg1) + { + throw new ArgumentNullException(nameof(arg1)); + } Color result = arg1.Subtract(); return ValueCheck(result); } @@ -351,9 +371,14 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The color containing the result of the multiplication. + /// Thrown when arg1 is null. /// 3 public static Color operator *(Color arg1, Color arg2) { + if (null == arg1) + { + throw new ArgumentNullException(nameof(arg1)); + } Color result = arg1.Multiply(arg2); return ValueCheck(result); } @@ -364,9 +389,14 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The color containing the result of the multiplication. + /// Thrown when arg1 is null. /// 3 public static Color operator *(Color arg1, float arg2) { + if (null == arg1) + { + throw new ArgumentNullException(nameof(arg1)); + } Color result = arg1.Multiply(arg2); return ValueCheck(result); } @@ -377,9 +407,14 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The color containing the result of the division. + /// Thrown when arg1 is null. /// 3 public static Color operator /(Color arg1, Color arg2) { + if (null == arg1) + { + throw new ArgumentNullException(nameof(arg1)); + } Color result = arg1.Divide(arg2); return ValueCheck(result); } @@ -390,9 +425,14 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The color containing the result of the division. + /// Thrown when arg1 is null. /// 3 public static Color operator /(Color arg1, float arg2) { + if (null == arg1) + { + throw new ArgumentNullException(nameof(arg1)); + } Color result = arg1.Divide(arg2); return ValueCheck(result); } @@ -504,6 +544,11 @@ namespace Tizen.NUI internal static float[] ValueCheck(float[] arr) { + if (null == arr) + { + throw new ArgumentNullException(nameof(arr)); + } + for (int i = 0; i < arr.Length; i++) { if (arr[i] < 0.0f) diff --git a/src/Tizen.NUI/src/public/CustomView/Spin.cs b/src/Tizen.NUI/src/public/CustomView/Spin.cs index a0bb48f..7e2818f 100755 --- a/src/Tizen.NUI/src/public/CustomView/Spin.cs +++ b/src/Tizen.NUI/src/public/CustomView/Spin.cs @@ -191,7 +191,10 @@ namespace Tizen.NUI } set { - NUILog.Debug("TextColor set to " + value.R + "," + value.G + "," + value.B); + if (value != null) + { + NUILog.Debug("TextColor set to " + value.R + "," + value.G + "," + value.B); + } _textColor = value; _textField.TextColor = _textColor; diff --git a/src/Tizen.NUI/src/public/CustomViewRegistry.cs b/src/Tizen.NUI/src/public/CustomViewRegistry.cs index cbdf7f8..3bd3a77 100755 --- a/src/Tizen.NUI/src/public/CustomViewRegistry.cs +++ b/src/Tizen.NUI/src/public/CustomViewRegistry.cs @@ -223,9 +223,15 @@ namespace Tizen.NUI /// } /// /// + /// Thrown when viewType is null. /// 3 public void Register(Func createFunction, System.Type viewType) { + if (null == viewType) + { + throw new ArgumentNullException(nameof(viewType)); + } + // add the mapping between the view name and it's create function _constructorMap.Add(viewType.ToString(), createFunction); diff --git a/src/Tizen.NUI/src/public/Extents.cs b/src/Tizen.NUI/src/public/Extents.cs index 828c09d..90c95d5 100755 --- a/src/Tizen.NUI/src/public/Extents.cs +++ b/src/Tizen.NUI/src/public/Extents.cs @@ -97,10 +97,15 @@ namespace Tizen.NUI /// Copy other extents /// /// + /// Thrown when that is null. /// Only used by Tizen.NUI.Components, will not be opened [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public void CopyFrom(Extents that) { + if (null == that) + { + throw new ArgumentNullException(nameof(that)); + } Interop.Extents.Extents_start_set(swigCPtr, that.Start); Interop.Extents.Extents_end_set(swigCPtr, that.End); Interop.Extents.Extents_top_set(swigCPtr, that.Top); diff --git a/src/Tizen.NUI/src/public/GLWindow.cs b/src/Tizen.NUI/src/public/GLWindow.cs index d262169..fb07266 100755 --- a/src/Tizen.NUI/src/public/GLWindow.cs +++ b/src/Tizen.NUI/src/public/GLWindow.cs @@ -106,6 +106,7 @@ namespace Tizen.NUI /// /// Gets or sets a size of the window. /// + /// Thrown when value is null. [EditorBrowsable(EditorBrowsableState.Never)] public Size2D WindowSize { @@ -120,6 +121,11 @@ namespace Tizen.NUI } set { + if (null == value) + { + throw new ArgumentNullException(nameof(value)); + } + global::System.IntPtr intPtr = Interop.GLWindow.GlWindow_GetPositionSize(swigCPtr); Rectangle val = new Rectangle(intPtr, true); Rectangle ret = new Rectangle(val.X, val.Y, value.Width, value.Height); @@ -396,9 +402,15 @@ namespace Tizen.NUI /// This API is for setting several orientations one time. /// /// The list of orientations. + /// Thrown when orientations is null. [EditorBrowsable(EditorBrowsableState.Never)] public void SetAvailableOrientations(List orientations) { + if (null == orientations) + { + throw new ArgumentNullException(nameof(orientations)); + } + PropertyArray orientationArray = new PropertyArray(); for (int i = 0; i < orientations.Count; i++) { diff --git a/src/Tizen.NUI/src/public/GraphicsTypeConverter.cs b/src/Tizen.NUI/src/public/GraphicsTypeConverter.cs index be726cd..ff1a1d2 100755 --- a/src/Tizen.NUI/src/public/GraphicsTypeConverter.cs +++ b/src/Tizen.NUI/src/public/GraphicsTypeConverter.cs @@ -41,20 +41,23 @@ namespace Tizen.NUI public virtual float ConvertScriptToPixel(string scriptValue) { float convertedValue = 0; - if (scriptValue.EndsWith("dp")) + if (scriptValue != null) { - convertedValue = ConvertToPixel(float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("dp")), CultureInfo.InvariantCulture)); - } - else if (scriptValue.EndsWith("px")) - { - convertedValue = float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("px")), CultureInfo.InvariantCulture); - } - else - { - if (!float.TryParse(scriptValue, NumberStyles.Any, CultureInfo.InvariantCulture, out convertedValue)) + if (scriptValue.EndsWith("dp")) + { + convertedValue = ConvertToPixel(float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("dp")), CultureInfo.InvariantCulture)); + } + else if (scriptValue.EndsWith("px")) + { + convertedValue = float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("px")), CultureInfo.InvariantCulture); + } + else { - NUILog.Error("Cannot convert the script {scriptValue}\n"); - convertedValue = 0; + if (!float.TryParse(scriptValue, NumberStyles.Any, CultureInfo.InvariantCulture, out convertedValue)) + { + NUILog.Error("Cannot convert the script {scriptValue}\n"); + convertedValue = 0; + } } } return convertedValue; diff --git a/src/Tizen.NUI/src/public/ImageLoading.cs b/src/Tizen.NUI/src/public/ImageLoading.cs index 6de37ca..1f98fa4 100755 --- a/src/Tizen.NUI/src/public/ImageLoading.cs +++ b/src/Tizen.NUI/src/public/ImageLoading.cs @@ -14,6 +14,7 @@ * limitations under the License. * */ +using System; using System.ComponentModel; namespace Tizen.NUI @@ -36,11 +37,16 @@ namespace Tizen.NUI /// The filtering method used when sampling pixels from the input image while fitting it to desired size. /// Reorient the image to respect any orientation metadata in its header. /// Handle to the loaded PixelBuffer object or an empty handle in case loading failed. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile__SWIG_0(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -55,11 +61,16 @@ namespace Tizen.NUI /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. /// The filtering method used when sampling pixels from the input image while fitting it to desired size. /// Handle to the loaded PixelBuffer object or an empty handle in case loading failed. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile__SWIG_1(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -73,11 +84,16 @@ namespace Tizen.NUI /// The width and height to fit the loaded image to, 0.0 means whole image. /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. /// Handle to the loaded PixelBuffer object or an empty handle in case loading failed. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile__SWIG_2(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -90,11 +106,16 @@ namespace Tizen.NUI /// The URL of the image file to load. /// The width and height to fit the loaded image to, 0.0 means whole image. /// Handle to the loaded PixelBuffer object or an empty handle in case loading failed. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static PixelBuffer LoadImageFromFile(string url, Size2D size) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile__SWIG_3(url, Uint16Pair.getCPtr(uSize)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -125,11 +146,16 @@ namespace Tizen.NUI /// The image filter to use if the image needs to be downsampled to the requested size. /// Whether to use image metadata to rotate or flip the image, for example, from portrait to landscape. /// Dimensions that image will have if it is loaded with given parameters. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); var val = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize__SWIG_0(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true); Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); @@ -145,11 +171,16 @@ namespace Tizen.NUI /// The method to use to map the source image to the desired dimensions. /// The image filter to use if the image needs to be downsampled to the requested size. /// Dimensions that image will have if it is loaded with given parameters. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); var val = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize__SWIG_1(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true); Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); @@ -164,11 +195,16 @@ namespace Tizen.NUI /// The requested size for the image /// The method to use to map the source image to the desired dimensions. /// Dimensions that image will have if it is loaded with given parameters. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); var val = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize__SWIG_2(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode), true); Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); @@ -182,11 +218,16 @@ namespace Tizen.NUI /// The name of the image. /// The requested size for the image /// Dimensions that image will have if it is loaded with given parameters. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static Size2D GetClosestImageSize(string filename, Size2D size) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); var val = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize__SWIG_3(filename, Uint16Pair.getCPtr(uSize)), true); Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); @@ -235,11 +276,16 @@ namespace Tizen.NUI /// The filtering method used when sampling pixels from the input image while fitting it to desired size. /// Reorient the image to respect any orientation metadata in its header. /// Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously__SWIG_0(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -254,11 +300,16 @@ namespace Tizen.NUI /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. /// The filtering method used when sampling pixels from the input image while fitting it to desired size. /// Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously__SWIG_1(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -272,11 +323,16 @@ namespace Tizen.NUI /// The width and height to fit the loaded image to, 0.0 means whole image. /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. /// Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously__SWIG_2(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -289,11 +345,16 @@ namespace Tizen.NUI /// The URL of the image file to load. /// The width and height to fit the loaded image to, 0.0 means whole image. /// Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed. + /// Thrown when size is null. /// 5 /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API. [EditorBrowsable(EditorBrowsableState.Never)] public static PixelBuffer DownloadImageSynchronously(string url, Size2D size) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously__SWIG_3(url, Uint16Pair.getCPtr(uSize)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); diff --git a/src/Tizen.NUI/src/public/KeyValue.cs b/src/Tizen.NUI/src/public/KeyValue.cs index c6c3029..87c5445 100755 --- a/src/Tizen.NUI/src/public/KeyValue.cs +++ b/src/Tizen.NUI/src/public/KeyValue.cs @@ -69,6 +69,7 @@ namespace Tizen.NUI /// /// OriginalKey property. /// + /// Thrown when value is null. public object OriginalKey { get @@ -77,6 +78,11 @@ namespace Tizen.NUI } set { + if (null == value) + { + throw new ArgumentNullException(nameof(value)); + } + _originalKey = value; if (value is int || value is Int32) { diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 3bda12f..d83222a 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -263,9 +263,15 @@ namespace Tizen.NUI /// /// /// + /// Thrown when child is null. /// 4 public override void Add(View child) { + if (null == child) + { + throw new ArgumentNullException(nameof(child)); + } + Container oldParent = child.GetParent(); if (oldParent != this) @@ -291,9 +297,15 @@ namespace Tizen.NUI /// /// /// + /// Thrown when child is null. /// 4 public override void Remove(View child) { + if (null == child) + { + throw new ArgumentNullException(nameof(child)); + } + Interop.Actor.ActorRemove(swigCPtr, View.getCPtr(child)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -344,6 +356,7 @@ namespace Tizen.NUI /// /// Downcasts a handle to layer handle. /// + /// Thrown when handle is null. /// 3 /// Please do not use! this will be deprecated! /// Instead please use as keyword. @@ -351,6 +364,10 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public static Layer DownCast(BaseHandle handle) { + if (null == handle) + { + throw new ArgumentNullException(nameof(handle)); + } Layer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Layer; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs b/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs index b1502f7..7fccbde 100755 --- a/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs @@ -627,9 +627,14 @@ namespace Tizen.NUI /// Derived classes can use this to set their own child properties on the child layout's owner.
/// /// The Layout child. + /// Thrown when child is null. /// 6 protected override void OnChildAdd(LayoutItem child) { + if (null == child) + { + throw new ArgumentNullException(nameof(child)); + } InsertChild(child); } diff --git a/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs index 0a45cab..b5f2db1 100755 --- a/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs +++ b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs @@ -48,10 +48,15 @@ namespace Tizen.NUI /// /// From ILayoutParent.
///
+ /// Thrown when childLayout is null. /// 6 /// LayoutItem to add to the layout group. public virtual void Add(LayoutItem childLayout) { + if (null == childLayout) + { + throw new ArgumentNullException(nameof(childLayout)); + } LayoutChildren.Add(childLayout); childLayout.SetParent(this); // Child added to use a Add transition. @@ -300,7 +305,7 @@ namespace Tizen.NUI { if (childDimension.AsRoundedValue() == LayoutParamPolicies.MatchParent) { - // Crashed. Cannot calculate. + // Crashed. Cannot calculate. // Child wants to be our size, but our size is not fixed. // Constrain child to not be bigger than us. @@ -533,9 +538,15 @@ namespace Tizen.NUI /// The child to measure. /// The width requirements for this view. /// The height requirements for this view. + /// Thrown when child is null. /// 6 protected virtual void MeasureChild(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, MeasureSpecification parentHeightMeasureSpec) { + if (null == child) + { + throw new ArgumentNullException(nameof(child)); + } + View childOwner = child.Owner; MeasureSpecification childWidthMeasureSpec = GetChildMeasureSpecification( @@ -561,11 +572,16 @@ namespace Tizen.NUI /// Extra space that has been used up by the parent horizontally (possibly by other children of the parent). /// The height requirements for this view. /// Extra space that has been used up by the parent vertically (possibly by other children of the parent). + /// Thrown when child is null. /// 6 protected virtual void MeasureChildWithMargins(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, LayoutLength widthUsed, MeasureSpecification parentHeightMeasureSpec, LayoutLength heightUsed) { - View childOwner = child.Owner; + if (null == child) + { + throw new ArgumentNullException(nameof(child)); + } + View childOwner = child.Owner; MeasureSpecification childWidthMeasureSpec = GetChildMeasureSpecification( new MeasureSpecification( diff --git a/src/Tizen.NUI/src/public/NUIComponentApplication.cs b/src/Tizen.NUI/src/public/NUIComponentApplication.cs index 318acfb1..690d412 100755 --- a/src/Tizen.NUI/src/public/NUIComponentApplication.cs +++ b/src/Tizen.NUI/src/public/NUIComponentApplication.cs @@ -43,9 +43,12 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public NUIComponentApplication(IDictionary typeInfo) : base(new NUIComponentCoreBackend()) { - foreach (var component in typeInfo) + if (typeInfo != null) { - RegisterComponent(component.Key, component.Value); + foreach (var component in typeInfo) + { + RegisterComponent(component.Key, component.Value); + } } (Backend as NUIComponentCoreBackend).ComponentFactories = _componentFactories; } diff --git a/src/Tizen.NUI/src/public/Position.cs b/src/Tizen.NUI/src/public/Position.cs index f6473fd..eaeca2e 100755 --- a/src/Tizen.NUI/src/public/Position.cs +++ b/src/Tizen.NUI/src/public/Position.cs @@ -679,7 +679,7 @@ namespace Tizen.NUI /// 3 public static Position operator +(Position arg1, Position arg2) { - return arg1.Add(arg2); + return arg1?.Add(arg2); } /// @@ -691,7 +691,7 @@ namespace Tizen.NUI /// 3 public static Position operator -(Position arg1, Position arg2) { - return arg1.Subtract(arg2); + return arg1?.Subtract(arg2); } /// @@ -702,7 +702,7 @@ namespace Tizen.NUI /// 3 public static Position operator -(Position arg1) { - return arg1.Subtract(); + return arg1?.Subtract(); } /// @@ -714,7 +714,7 @@ namespace Tizen.NUI /// 3 public static Position operator *(Position arg1, Position arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -726,7 +726,7 @@ namespace Tizen.NUI /// 3 public static Position operator *(Position arg1, float arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -738,7 +738,7 @@ namespace Tizen.NUI /// 3 public static Position operator /(Position arg1, Position arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -750,7 +750,7 @@ namespace Tizen.NUI /// 3 public static Position operator /(Position arg1, float arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -759,7 +759,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Vector3(Position Position) { - return new Vector3(Position.X, Position.Y, Position.Z); + return new Vector3((float)Position?.X, (float)Position.Y, (float)Position.Z); } /// @@ -768,7 +768,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Position(Vector3 vec) { - return new Position(vec.X, vec.Y, vec.Z); + return new Position((float)vec?.X, (float)vec.Y, (float)vec.Z); } /// @@ -780,7 +780,7 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public static implicit operator Position(Position2D position2d) { - return new Position(position2d.X, position2d.Y, 0); + return new Position((float)position2d?.X, (float)position2d.Y, 0); } /// diff --git a/src/Tizen.NUI/src/public/Position2D.cs b/src/Tizen.NUI/src/public/Position2D.cs index e94aa7b..9abbc87 100755 --- a/src/Tizen.NUI/src/public/Position2D.cs +++ b/src/Tizen.NUI/src/public/Position2D.cs @@ -183,7 +183,7 @@ namespace Tizen.NUI /// 3 public static Position2D operator +(Position2D arg1, Position2D arg2) { - return arg1.Add(arg2); + return arg1?.Add(arg2); } /// @@ -195,7 +195,7 @@ namespace Tizen.NUI /// 3 public static Position2D operator -(Position2D arg1, Position2D arg2) { - return arg1.Subtract(arg2); + return arg1?.Subtract(arg2); } /// @@ -206,7 +206,7 @@ namespace Tizen.NUI /// 3 public static Position2D operator -(Position2D arg1) { - return arg1.Subtract(); + return arg1?.Subtract(); } /// @@ -218,7 +218,7 @@ namespace Tizen.NUI /// 3 public static Position2D operator *(Position2D arg1, Position2D arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -230,7 +230,7 @@ namespace Tizen.NUI /// 3 public static Position2D operator *(Position2D arg1, int arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -242,7 +242,7 @@ namespace Tizen.NUI /// 3 public static Position2D operator /(Position2D arg1, Position2D arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -254,7 +254,7 @@ namespace Tizen.NUI /// 3 public static Position2D operator /(Position2D arg1, int arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -317,7 +317,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Vector2(Position2D position2d) { - return new Vector2((float)position2d.X, (float)position2d.Y); + return new Vector2((float)position2d?.X, (float)position2d.Y); } /// @@ -328,7 +328,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Position2D(Vector2 vec) { - return new Position2D((int)vec.X, (int)vec.Y); + return new Position2D((int)vec?.X, (int)vec.Y); } /// @@ -340,7 +340,7 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public static implicit operator Position2D(Position position) { - return new Position2D((int)position.X, (int)position.Y); + return new Position2D((int)position?.X, (int)position.Y); } /// diff --git a/src/Tizen.NUI/src/public/PropertyArray.cs b/src/Tizen.NUI/src/public/PropertyArray.cs index 0edb133..3bad805 100755 --- a/src/Tizen.NUI/src/public/PropertyArray.cs +++ b/src/Tizen.NUI/src/public/PropertyArray.cs @@ -153,8 +153,13 @@ namespace Tizen.NUI /// This function should be first /// /// The value to add at the end of the array. + /// Thrown when value is null. public PropertyArray Add(KeyValue value) { + if (null == value) + { + throw new global::System.ArgumentNullException(nameof(value)); + } PropertyArray ret = new PropertyArray(Interop.Property.Property_Array_Add(swigCPtr, PropertyValue.getCPtr(value.TrueValue)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/PropertyMap.cs b/src/Tizen.NUI/src/public/PropertyMap.cs index a34f4b7..f6a9eed 100755 --- a/src/Tizen.NUI/src/public/PropertyMap.cs +++ b/src/Tizen.NUI/src/public/PropertyMap.cs @@ -172,8 +172,13 @@ namespace Tizen.NUI /// /// The keyvalue to insert. /// Returns a reference to this object. + /// Thrown when keyValue is null. public PropertyMap Add(KeyValue keyValue) { + if (null == keyValue) + { + throw new global::System.ArgumentNullException(nameof(keyValue)); + } if (keyValue.KeyInt != null) { Interop.PropertyMap.Property_Map_Add__SWIG_2(swigCPtr, (int)keyValue.KeyInt, PropertyValue.getCPtr(keyValue.TrueValue)); diff --git a/src/Tizen.NUI/src/public/PropertyNotification.cs b/src/Tizen.NUI/src/public/PropertyNotification.cs index e61e33a..c9612ae 100755 --- a/src/Tizen.NUI/src/public/PropertyNotification.cs +++ b/src/Tizen.NUI/src/public/PropertyNotification.cs @@ -144,9 +144,14 @@ namespace Tizen.NUI /// /// Handle to an object of BaseHandle type. /// Handle to an object of the PropertyNotification type. + /// Thrown when handle is null. /// 4 public static PropertyNotification DownCast(BaseHandle handle) { + if (null == handle) + { + throw new ArgumentNullException(nameof(handle)); + } PropertyNotification ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PropertyNotification; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/PropertyValue.cs b/src/Tizen.NUI/src/public/PropertyValue.cs index b0ea75d..cc6ff7a 100755 --- a/src/Tizen.NUI/src/public/PropertyValue.cs +++ b/src/Tizen.NUI/src/public/PropertyValue.cs @@ -249,11 +249,16 @@ namespace Tizen.NUI /// /// An object to create. /// The created value. + /// Thrown when obj is null. /// 3 static public PropertyValue CreateFromObject(System.Object obj) { - System.Type type = obj.GetType(); + if (null == obj) + { + throw new global::System.ArgumentNullException(nameof(obj)); + } + System.Type type = obj.GetType(); PropertyValue value; if (type.IsEnum) { diff --git a/src/Tizen.NUI/src/public/RelativeVector2.cs b/src/Tizen.NUI/src/public/RelativeVector2.cs index 14bae45..fe6a5db 100755 --- a/src/Tizen.NUI/src/public/RelativeVector2.cs +++ b/src/Tizen.NUI/src/public/RelativeVector2.cs @@ -131,7 +131,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector2 operator +(RelativeVector2 arg1, RelativeVector2 arg2) { - RelativeVector2 result = arg1.Add(arg2); + RelativeVector2 result = arg1?.Add(arg2); return result; } @@ -144,7 +144,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector2 operator -(RelativeVector2 arg1, RelativeVector2 arg2) { - RelativeVector2 result = arg1.Subtract(arg2); + RelativeVector2 result = arg1?.Subtract(arg2); return result; } @@ -157,7 +157,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector2 operator *(RelativeVector2 arg1, RelativeVector2 arg2) { - RelativeVector2 result = arg1.Multiply(arg2); + RelativeVector2 result = arg1?.Multiply(arg2); return result; } @@ -170,7 +170,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector2 operator *(RelativeVector2 arg1, float arg2) { - RelativeVector2 result = arg1.Multiply(arg2); + RelativeVector2 result = arg1?.Multiply(arg2); return result; } @@ -183,7 +183,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector2 operator /(RelativeVector2 arg1, RelativeVector2 arg2) { - RelativeVector2 result = arg1.Divide(arg2); + RelativeVector2 result = arg1?.Divide(arg2); return result; } @@ -196,7 +196,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector2 operator /(RelativeVector2 arg1, float arg2) { - RelativeVector2 result = arg1.Divide(arg2); + RelativeVector2 result = arg1?.Divide(arg2); return result; } @@ -205,7 +205,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Vector2(RelativeVector2 relativeVector2) { - return new Vector2(relativeVector2.X, relativeVector2.Y); + return new Vector2((float)relativeVector2?.X, (float)relativeVector2.Y); } /// @@ -213,7 +213,7 @@ namespace Tizen.NUI /// 3 public static implicit operator RelativeVector2(Vector2 vec) { - return new RelativeVector2(vec.X, vec.Y); + return new RelativeVector2((float)vec?.X, (float)vec.Y); } /// diff --git a/src/Tizen.NUI/src/public/RelativeVector3.cs b/src/Tizen.NUI/src/public/RelativeVector3.cs index f0db2d2..1a01567 100755 --- a/src/Tizen.NUI/src/public/RelativeVector3.cs +++ b/src/Tizen.NUI/src/public/RelativeVector3.cs @@ -145,7 +145,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector3 operator +(RelativeVector3 arg1, RelativeVector3 arg2) { - RelativeVector3 result = arg1.Add(arg2); + RelativeVector3 result = arg1?.Add(arg2); return result; } @@ -158,7 +158,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector3 operator -(RelativeVector3 arg1, RelativeVector3 arg2) { - RelativeVector3 result = arg1.Subtract(arg2); + RelativeVector3 result = arg1?.Subtract(arg2); return result; } @@ -171,7 +171,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector3 operator *(RelativeVector3 arg1, RelativeVector3 arg2) { - RelativeVector3 result = arg1.Multiply(arg2); + RelativeVector3 result = arg1?.Multiply(arg2); return result; } @@ -184,7 +184,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector3 operator *(RelativeVector3 arg1, float arg2) { - RelativeVector3 result = arg1.Multiply(arg2); + RelativeVector3 result = arg1?.Multiply(arg2); return result; } @@ -197,7 +197,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector3 operator /(RelativeVector3 arg1, RelativeVector3 arg2) { - RelativeVector3 result = arg1.Divide(arg2); + RelativeVector3 result = arg1?.Divide(arg2); return result; } @@ -210,7 +210,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector3 operator /(RelativeVector3 arg1, float arg2) { - RelativeVector3 result = arg1.Divide(arg2); + RelativeVector3 result = arg1?.Divide(arg2); return result; } diff --git a/src/Tizen.NUI/src/public/RelativeVector4.cs b/src/Tizen.NUI/src/public/RelativeVector4.cs index 2662d40..1decc2e 100755 --- a/src/Tizen.NUI/src/public/RelativeVector4.cs +++ b/src/Tizen.NUI/src/public/RelativeVector4.cs @@ -184,7 +184,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector4 operator +(RelativeVector4 arg1, RelativeVector4 arg2) { - RelativeVector4 result = arg1.Add(arg2); + RelativeVector4 result = arg1?.Add(arg2); return result; } @@ -197,7 +197,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector4 operator -(RelativeVector4 arg1, RelativeVector4 arg2) { - RelativeVector4 result = arg1.Subtract(arg2); + RelativeVector4 result = arg1?.Subtract(arg2); return result; } @@ -210,7 +210,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector4 operator *(RelativeVector4 arg1, RelativeVector4 arg2) { - RelativeVector4 result = arg1.Multiply(arg2); + RelativeVector4 result = arg1?.Multiply(arg2); return result; } @@ -223,7 +223,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector4 operator *(RelativeVector4 arg1, float arg2) { - RelativeVector4 result = arg1.Multiply(arg2); + RelativeVector4 result = arg1?.Multiply(arg2); return result; } @@ -236,7 +236,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector4 operator /(RelativeVector4 arg1, RelativeVector4 arg2) { - RelativeVector4 result = arg1.Divide(arg2); + RelativeVector4 result = arg1?.Divide(arg2); return result; } @@ -249,7 +249,7 @@ namespace Tizen.NUI /// 3 public static RelativeVector4 operator /(RelativeVector4 arg1, float arg2) { - RelativeVector4 result = arg1.Divide(arg2); + RelativeVector4 result = arg1?.Divide(arg2); return result; } @@ -258,7 +258,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Vector4(RelativeVector4 relativeVector4) { - return new Vector4(relativeVector4.X, relativeVector4.Y, relativeVector4.Z, relativeVector4.W); + return new Vector4((float)relativeVector4?.X, (float)relativeVector4.Y, (float)relativeVector4.Z, (float)relativeVector4.W); } /// @@ -266,7 +266,7 @@ namespace Tizen.NUI /// 3 public static implicit operator RelativeVector4(Vector4 vec) { - return new RelativeVector4(vec.X, vec.Y, vec.Z, vec.W); + return new RelativeVector4((float)vec?.X, (float)vec.Y, (float)vec.Z, (float)vec.W); } /// diff --git a/src/Tizen.NUI/src/public/Rotation.cs b/src/Tizen.NUI/src/public/Rotation.cs index 67c03e9..3943291 100755 --- a/src/Tizen.NUI/src/public/Rotation.cs +++ b/src/Tizen.NUI/src/public/Rotation.cs @@ -71,7 +71,7 @@ namespace Tizen.NUI /// 3 public static Rotation operator +(Rotation arg1, Rotation arg2) { - return arg1.Add(arg2); + return arg1?.Add(arg2); } /// @@ -83,7 +83,7 @@ namespace Tizen.NUI /// 3 public static Rotation operator -(Rotation arg1, Rotation arg2) { - return arg1.Subtract(arg2); + return arg1?.Subtract(arg2); } /// @@ -94,7 +94,7 @@ namespace Tizen.NUI /// 3 public static Rotation operator -(Rotation arg1) { - return arg1.Subtract(); + return arg1?.Subtract(); } /// @@ -106,7 +106,7 @@ namespace Tizen.NUI /// 3 public static Rotation operator *(Rotation arg1, Rotation arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -118,7 +118,7 @@ namespace Tizen.NUI /// 3 public static Vector3 operator *(Rotation arg1, Vector3 arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -130,7 +130,7 @@ namespace Tizen.NUI /// 3 public static Rotation operator *(Rotation arg1, float arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -142,7 +142,7 @@ namespace Tizen.NUI /// 3 public static Rotation operator /(Rotation arg1, Rotation arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -154,7 +154,7 @@ namespace Tizen.NUI /// 3 public static Rotation operator /(Rotation arg1, float arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// diff --git a/src/Tizen.NUI/src/public/Size.cs b/src/Tizen.NUI/src/public/Size.cs index 8ae5a7d..f65e33c 100755 --- a/src/Tizen.NUI/src/public/Size.cs +++ b/src/Tizen.NUI/src/public/Size.cs @@ -172,7 +172,7 @@ namespace Tizen.NUI /// 5 public static Size operator +(Size arg1, Size arg2) { - return arg1.Add(arg2); + return arg1?.Add(arg2); } /// @@ -184,7 +184,7 @@ namespace Tizen.NUI /// 5 public static Size operator -(Size arg1, Size arg2) { - return arg1.Subtract(arg2); + return arg1?.Subtract(arg2); } /// @@ -195,7 +195,7 @@ namespace Tizen.NUI /// 5 public static Size operator -(Size arg1) { - return arg1.Subtract(); + return arg1?.Subtract(); } /// @@ -207,7 +207,7 @@ namespace Tizen.NUI /// 5 public static Size operator *(Size arg1, Size arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -219,7 +219,7 @@ namespace Tizen.NUI /// 5 public static Size operator *(Size arg1, float arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -231,7 +231,7 @@ namespace Tizen.NUI /// 5 public static Size operator /(Size arg1, Size arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -243,7 +243,7 @@ namespace Tizen.NUI /// 5 public static Size operator /(Size arg1, float arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -325,7 +325,7 @@ namespace Tizen.NUI /// 5 public static implicit operator Vector3(Size size) { - return new Vector3(size.Width, size.Height, size.Depth); + return new Vector3((float)size?.Width, (float)size.Height, (float)size.Depth); } /// @@ -335,7 +335,7 @@ namespace Tizen.NUI /// 5 public static implicit operator Size(Vector3 vec) { - return new Size(vec.Width, vec.Height, vec.Depth); + return new Size((int)vec?.Width, (int)vec.Height, (int)vec.Depth); } /// @@ -347,7 +347,7 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public static implicit operator Size(Size2D size2d) { - return new Size(size2d.Width, size2d.Height, 0); + return new Size((int)size2d?.Width, (int)size2d.Height, 0); } diff --git a/src/Tizen.NUI/src/public/Size2D.cs b/src/Tizen.NUI/src/public/Size2D.cs index 818a625..075b066 100755 --- a/src/Tizen.NUI/src/public/Size2D.cs +++ b/src/Tizen.NUI/src/public/Size2D.cs @@ -126,7 +126,7 @@ namespace Tizen.NUI /// 3 public static Size2D operator +(Size2D arg1, Size2D arg2) { - return arg1.Add(arg2); + return arg1?.Add(arg2); } /// @@ -138,7 +138,7 @@ namespace Tizen.NUI /// 3 public static Size2D operator -(Size2D arg1, Size2D arg2) { - return arg1.Subtract(arg2); + return arg1?.Subtract(arg2); } /// @@ -149,7 +149,7 @@ namespace Tizen.NUI /// 3 public static Size2D operator -(Size2D arg1) { - return arg1.Subtract(); + return arg1?.Subtract(); } /// @@ -161,7 +161,7 @@ namespace Tizen.NUI /// 3 public static Size2D operator *(Size2D arg1, Size2D arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -174,7 +174,7 @@ namespace Tizen.NUI /// 3 public static Size2D operator *(Size2D arg1, int arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -186,7 +186,7 @@ namespace Tizen.NUI /// 3 public static Size2D operator /(Size2D arg1, Size2D arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -198,7 +198,7 @@ namespace Tizen.NUI /// 3 public static Size2D operator /(Size2D arg1, int arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -209,7 +209,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Vector2(Size2D size) { - return new Vector2((float)size.Width, (float)size.Height); + return new Vector2((float)size?.Width, (float)size.Height); } /// @@ -220,7 +220,7 @@ namespace Tizen.NUI /// 3 public static implicit operator Size2D(Vector2 vector2) { - return new Size2D((int)vector2.X, (int)vector2.Y); + return new Size2D((int)vector2?.X, (int)vector2.Y); } /// @@ -232,7 +232,7 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public static implicit operator Size2D(Size size) { - return new Size2D((int)size.Width, (int)size.Height); + return new Size2D((int)size?.Width, (int)size.Height); } diff --git a/src/Tizen.NUI/src/public/UIComponents/Slider.cs b/src/Tizen.NUI/src/public/UIComponents/Slider.cs index a997e18..d959eca 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Slider.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Slider.cs @@ -737,12 +737,17 @@ namespace Tizen.NUI.UIComponents /// /// The handle to an object. /// The handle to a slider or an uninitialized handle. + /// Thrown when handle is null. /// 3 /// This will be deprecated [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")] [EditorBrowsable(EditorBrowsableState.Never)] public static Slider DownCast(BaseHandle handle) { + if (null == handle) + { + throw new ArgumentNullException(nameof(handle)); + } Slider ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Slider; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/Vector2.cs b/src/Tizen.NUI/src/public/Vector2.cs index 931f582..0c7e850 100755 --- a/src/Tizen.NUI/src/public/Vector2.cs +++ b/src/Tizen.NUI/src/public/Vector2.cs @@ -64,7 +64,7 @@ namespace Tizen.NUI /// /// The copy target. [EditorBrowsable(EditorBrowsableState.Never)] - public Vector2(Vector2 other) : this(other.X, other.Y) + public Vector2(Vector2 other) : this((float)other?.X, (float)other.Y) { } @@ -314,7 +314,7 @@ namespace Tizen.NUI /// 3 public static Vector2 operator +(Vector2 arg1, Vector2 arg2) { - return arg1.Add(arg2); + return arg1?.Add(arg2); } /// @@ -326,7 +326,7 @@ namespace Tizen.NUI /// 3 public static Vector2 operator -(Vector2 arg1, Vector2 arg2) { - return arg1.Subtract(arg2); + return arg1?.Subtract(arg2); } /// @@ -337,7 +337,7 @@ namespace Tizen.NUI /// 3 public static Vector2 operator -(Vector2 arg1) { - return arg1.Subtract(); + return arg1?.Subtract(); } /// @@ -349,7 +349,7 @@ namespace Tizen.NUI /// 3 public static Vector2 operator *(Vector2 arg1, Vector2 arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -361,7 +361,7 @@ namespace Tizen.NUI /// 3 public static Vector2 operator *(Vector2 arg1, float arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -373,7 +373,7 @@ namespace Tizen.NUI /// 3 public static Vector2 operator /(Vector2 arg1, Vector2 arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -385,7 +385,7 @@ namespace Tizen.NUI /// 3 public static Vector2 operator /(Vector2 arg1, float arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// diff --git a/src/Tizen.NUI/src/public/Vector3.cs b/src/Tizen.NUI/src/public/Vector3.cs index 379987e..49059ea 100755 --- a/src/Tizen.NUI/src/public/Vector3.cs +++ b/src/Tizen.NUI/src/public/Vector3.cs @@ -450,7 +450,7 @@ namespace Tizen.NUI /// 3 public static Vector3 operator +(Vector3 arg1, Vector3 arg2) { - return arg1.Add(arg2); + return arg1?.Add(arg2); } /// @@ -462,7 +462,7 @@ namespace Tizen.NUI /// 3 public static Vector3 operator -(Vector3 arg1, Vector3 arg2) { - return arg1.Subtract(arg2); + return arg1?.Subtract(arg2); } /// @@ -473,7 +473,7 @@ namespace Tizen.NUI /// 3 public static Vector3 operator -(Vector3 arg1) { - return arg1.Subtract(); + return arg1?.Subtract(); } /// @@ -485,7 +485,7 @@ namespace Tizen.NUI /// 3 public static Vector3 operator *(Vector3 arg1, Vector3 arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -497,7 +497,7 @@ namespace Tizen.NUI /// 3 public static Vector3 operator *(Vector3 arg1, float arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -509,7 +509,7 @@ namespace Tizen.NUI /// 3 public static Vector3 operator /(Vector3 arg1, Vector3 arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -521,7 +521,7 @@ namespace Tizen.NUI /// 3 public static Vector3 operator /(Vector3 arg1, float arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// diff --git a/src/Tizen.NUI/src/public/Vector4.cs b/src/Tizen.NUI/src/public/Vector4.cs index 49e0480..f53896f 100755 --- a/src/Tizen.NUI/src/public/Vector4.cs +++ b/src/Tizen.NUI/src/public/Vector4.cs @@ -480,7 +480,7 @@ namespace Tizen.NUI /// 3 public static Vector4 operator +(Vector4 arg1, Vector4 arg2) { - return arg1.Add(arg2); + return arg1?.Add(arg2); } /// @@ -492,7 +492,7 @@ namespace Tizen.NUI /// 3 public static Vector4 operator -(Vector4 arg1, Vector4 arg2) { - return arg1.Subtract(arg2); + return arg1?.Subtract(arg2); } /// @@ -503,7 +503,7 @@ namespace Tizen.NUI /// 3 public static Vector4 operator -(Vector4 arg1) { - return arg1.Subtract(); + return arg1?.Subtract(); } /// @@ -515,7 +515,7 @@ namespace Tizen.NUI /// 3 public static Vector4 operator *(Vector4 arg1, Vector4 arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -527,7 +527,7 @@ namespace Tizen.NUI /// 3 public static Vector4 operator *(Vector4 arg1, float arg2) { - return arg1.Multiply(arg2); + return arg1?.Multiply(arg2); } /// @@ -539,7 +539,7 @@ namespace Tizen.NUI /// 3 public static Vector4 operator /(Vector4 arg1, Vector4 arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// @@ -551,7 +551,7 @@ namespace Tizen.NUI /// 3 public static Vector4 operator /(Vector4 arg1, float arg2) { - return arg1.Divide(arg2); + return arg1?.Divide(arg2); } /// diff --git a/src/Tizen.NUI/src/public/VertexBuffer.cs b/src/Tizen.NUI/src/public/VertexBuffer.cs index 23aea02..b1d7bad 100755 --- a/src/Tizen.NUI/src/public/VertexBuffer.cs +++ b/src/Tizen.NUI/src/public/VertexBuffer.cs @@ -49,10 +49,16 @@ namespace Tizen.NUI /// This function expects an array of structures with the same format that was given in the construction. /// /// The vertex data that will be copied to the buffer. + /// Thrown when vertices is null. /// 8 public void SetData(VertexType[] vertices) where VertexType : struct { + if (null == vertices) + { + throw new ArgumentNullException(nameof(vertices)); + } + int structSize = Marshal.SizeOf(); global::System.IntPtr buffer = Marshal.AllocHGlobal(structSize * vertices.Length); diff --git a/src/Tizen.NUI/src/public/ViewProperty/ImageShadow.cs b/src/Tizen.NUI/src/public/ViewProperty/ImageShadow.cs index 036b3cf..eab37dc 100644 --- a/src/Tizen.NUI/src/public/ViewProperty/ImageShadow.cs +++ b/src/Tizen.NUI/src/public/ViewProperty/ImageShadow.cs @@ -52,7 +52,7 @@ namespace Tizen.NUI /// Constructor /// [EditorBrowsable(EditorBrowsableState.Never)] - public ImageShadow(ImageShadow other) : this(other.Url, other.Border, other.Offset, other.Extents) + public ImageShadow(ImageShadow other) : this(other?.Url, other.Border, other.Offset, other.Extents) { } diff --git a/src/Tizen.NUI/src/public/ViewProperty/Shadow.cs b/src/Tizen.NUI/src/public/ViewProperty/Shadow.cs index 33fb725..be4c30e 100644 --- a/src/Tizen.NUI/src/public/ViewProperty/Shadow.cs +++ b/src/Tizen.NUI/src/public/ViewProperty/Shadow.cs @@ -55,7 +55,7 @@ namespace Tizen.NUI /// Copy constructor. /// [EditorBrowsable(EditorBrowsableState.Never)] - public Shadow(Shadow other) : this(other.BlurRadius, other.Offset, other.Color, other.Extents) + public Shadow(Shadow other) : this((float)other?.BlurRadius, other.Offset, other.Color, other.Extents) { } diff --git a/src/Tizen.NUI/src/public/ViewProperty/ShadowBase.cs b/src/Tizen.NUI/src/public/ViewProperty/ShadowBase.cs index 4bd1b6a..ee9a8fa 100755 --- a/src/Tizen.NUI/src/public/ViewProperty/ShadowBase.cs +++ b/src/Tizen.NUI/src/public/ViewProperty/ShadowBase.cs @@ -80,7 +80,7 @@ namespace Tizen.NUI /// Copy Constructor /// [EditorBrowsable(EditorBrowsableState.Never)] - protected ShadowBase(ShadowBase other) : this(other.Offset, other.Extents) + protected ShadowBase(ShadowBase other) : this(other?.Offset, other.Extents) { } diff --git a/src/Tizen.NUI/src/public/WidgetViewManager.cs b/src/Tizen.NUI/src/public/WidgetViewManager.cs index 90d9617..6617172 100755 --- a/src/Tizen.NUI/src/public/WidgetViewManager.cs +++ b/src/Tizen.NUI/src/public/WidgetViewManager.cs @@ -30,7 +30,7 @@ namespace Tizen.NUI /// Creates a new widgetView manager object. /// /// 3 - public WidgetViewManager(NUIApplication nuiApplication, string appId) : this(Interop.WidgetViewManager.WidgetViewManager_New(Application.getCPtr(nuiApplication.ApplicationHandle), appId), true) + public WidgetViewManager(NUIApplication nuiApplication, string appId) : this(Interop.WidgetViewManager.WidgetViewManager_New(Application.getCPtr(nuiApplication?.ApplicationHandle), appId), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index 793e97a..4d7f319 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -326,6 +326,7 @@ namespace Tizen.NUI /// /// Gets or sets a size of the window. /// + /// Thrown when value is null. /// 4 public Size2D WindowSize { @@ -342,6 +343,7 @@ namespace Tizen.NUI /// /// Gets or sets a position of the window. /// + /// Thrown when value is null. /// 4 public Position2D WindowPosition { @@ -753,7 +755,10 @@ namespace Tizen.NUI Interop.Actor.ActorAdd(Layer.getCPtr(GetRootLayer()), View.getCPtr(view)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer - view.InternalParent = this.GetRootLayer(); + if (null != view) + { + view.InternalParent = this.GetRootLayer(); + } } /// @@ -765,7 +770,10 @@ namespace Tizen.NUI { Interop.Actor.ActorRemove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view)); this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer - view.InternalParent = null; + if (null != view) + { + view.InternalParent = null; + } } /// @@ -900,6 +908,7 @@ namespace Tizen.NUI /// Adds a layer to the stage. /// /// Layer to add. + /// Thrown when layer is null. /// 3 public void AddLayer(Layer layer) { @@ -910,6 +919,7 @@ namespace Tizen.NUI /// Removes a layer from the stage. /// /// Layer to remove. + /// Thrown when layer is null. /// 3 public void RemoveLayer(Layer layer) { @@ -1097,9 +1107,12 @@ namespace Tizen.NUI public void SetAvailableOrientations(List orientations) { PropertyArray orientationArray = new PropertyArray(); - for (int i = 0; i < orientations.Count; i++) + if (null != orientations) { - orientationArray.PushBack(new PropertyValue((int)orientations[i])); + for (int i = 0; i < orientations.Count; i++) + { + orientationArray.PushBack(new PropertyValue((int)orientations[i])); + } } Interop.Window.Window_SetAvailableOrientations(swigCPtr, PropertyArray.getCPtr(orientationArray)); @@ -1127,6 +1140,10 @@ namespace Tizen.NUI internal void Add(Layer layer) { + if (null == layer) + { + throw new ArgumentNullException(nameof(layer)); + } Interop.Window.Add(swigCPtr, Layer.getCPtr(layer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -1136,6 +1153,10 @@ namespace Tizen.NUI internal void Remove(Layer layer) { + if (null == layer) + { + throw new ArgumentNullException(nameof(layer)); + } Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -1228,6 +1249,10 @@ namespace Tizen.NUI internal void SetWindowSize(Size2D size) { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } var val = new Uint16Pair((uint)size.Width, (uint)size.Height); Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val)); @@ -1247,6 +1272,10 @@ namespace Tizen.NUI internal void SetPosition(Position2D position) { + if (null == position) + { + throw new ArgumentNullException(nameof(position)); + } var val = new Uint16Pair((uint)position.X, (uint)position.Y); Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val)); diff --git a/src/Tizen.NUI/src/public/XamlBinding/BindableObject.cs b/src/Tizen.NUI/src/public/XamlBinding/BindableObject.cs index b7d5b27..4e33927 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/BindableObject.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/BindableObject.cs @@ -209,6 +209,7 @@ namespace Tizen.NUI.Binding /// /// The BindableProperty on which to assign a value. /// The value to set. + /// Thrown when property is null. /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public void SetValue(BindableProperty property, object value) @@ -219,6 +220,10 @@ namespace Tizen.NUI.Binding } else { + if (null == property) + { + throw new ArgumentNullException(nameof(property)); + } property.PropertyChanged?.Invoke(this, null, value); OnPropertyChanged(property.PropertyName); @@ -264,9 +269,15 @@ namespace Tizen.NUI.Binding /// /// The object on which to set the inherited binding context. /// The inherited context to set. + /// Thrown when bindable is null. [EditorBrowsable(EditorBrowsableState.Never)] public static void SetInheritedBindingContext(BindableObject bindable, object value) { + if (null == bindable) + { + throw new ArgumentNullException(nameof(bindable)); + } + BindablePropertyContext bpContext = bindable.GetContext(BindingContextProperty); if (bpContext != null && ((bpContext.Attributes & BindableContextAttributes.IsManuallySet) != 0)) return; diff --git a/src/Tizen.NUI/src/public/XamlBinding/ColorTypeConverter.cs b/src/Tizen.NUI/src/public/XamlBinding/ColorTypeConverter.cs index 8860292..8a738c2 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/ColorTypeConverter.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/ColorTypeConverter.cs @@ -140,8 +140,12 @@ namespace Tizen.NUI.Binding [EditorBrowsable(EditorBrowsableState.Never)] public override string ConvertToString(object value) { - Color color = (Color)value; - return color.R.ToString() + " " + color.G.ToString() + " " + color.B.ToString() + " " + color.A.ToString(); + if (value != null) + { + Color color = (Color)value; + return color.R.ToString() + " " + color.G.ToString() + " " + color.B.ToString() + " " + color.A.ToString(); + } + return ""; } } } diff --git a/src/Tizen.NUI/src/public/XamlBinding/Element.cs b/src/Tizen.NUI/src/public/XamlBinding/Element.cs index 2aa496c..3184e3d 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/Element.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/Element.cs @@ -336,10 +336,16 @@ namespace Tizen.NUI.Binding /// Invoked whenever the ChildAdded event needs to be emitted.Implement this method to add class handling for this event. /// /// The element that was added. - /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. + /// Thrown when child is null. + /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] protected virtual void OnChildAdded(Element child) { + if (child == null) + { + throw new ArgumentNullException(nameof(child)); + } + child.Parent = this; child.ApplyBindings(skipBindingContext: false, fromBindingContextChanged: true); @@ -355,10 +361,16 @@ namespace Tizen.NUI.Binding /// Invoked whenever the ChildRemoved event needs to be emitted.Implement this method to add class handling for this event. /// /// The element that was removed. - /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. + /// Thrown when child is null. + /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] protected virtual void OnChildRemoved(Element child) { + if (child == null) + { + throw new ArgumentNullException(nameof(child)); + } + child.Parent = null; ChildRemoved?.Invoke(child, new ElementEventArgs(child)); diff --git a/src/Tizen.NUI/src/public/XamlBinding/Internals/NameScope.cs b/src/Tizen.NUI/src/public/XamlBinding/Internals/NameScope.cs index 69ef3f3..ae81b77 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/Internals/NameScope.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/Internals/NameScope.cs @@ -54,13 +54,18 @@ namespace Tizen.NUI.Binding.Internals [EditorBrowsable(EditorBrowsableState.Never)] public static INameScope GetNameScope(BindableObject bindable) { - return (INameScope)bindable.GetValue(NameScopeProperty); + return (INameScope)bindable?.GetValue(NameScopeProperty); } + /// Thrown when bindable is 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 static void SetNameScope(BindableObject bindable, INameScope value) { + if (null == bindable) + { + throw new ArgumentNullException(nameof(bindable)); + } bindable.SetValue(NameScopeProperty, value); } } diff --git a/src/Tizen.NUI/src/public/XamlBinding/SizeTypeConverter.cs b/src/Tizen.NUI/src/public/XamlBinding/SizeTypeConverter.cs index 007a392..5136a3c 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/SizeTypeConverter.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/SizeTypeConverter.cs @@ -43,8 +43,12 @@ namespace Tizen.NUI.Binding [EditorBrowsable(EditorBrowsableState.Never)] public override string ConvertToString(object value) { - Size size = (Size)value; - return size.Width.ToString() + " " + size.Height.ToString() + " " + size.Depth.ToString(); + if (value != null) + { + Size size = (Size)value; + return size.Width.ToString() + " " + size.Height.ToString() + " " + size.Depth.ToString(); + } + return ""; } } @@ -75,8 +79,12 @@ namespace Tizen.NUI.Binding [EditorBrowsable(EditorBrowsableState.Never)] public override string ConvertToString(object value) { - Size2D size = (Size2D)value; - return size.Width.ToString() + " " + size.Height.ToString(); + if (value != null) + { + Size2D size = (Size2D)value; + return size.Width.ToString() + " " + size.Height.ToString(); + } + return ""; } } } diff --git a/src/Tizen.NUI/src/public/XamlBinding/Transition.cs b/src/Tizen.NUI/src/public/XamlBinding/Transition.cs index 9dc577e..603e70e 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/Transition.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/Transition.cs @@ -149,7 +149,7 @@ namespace Tizen.NUI AnimationBehavior behavior = null; behaviors.TryGetValue(behaviorKey, out behavior); - if (null != behavior) + if (null != instance && null != behavior) { var elementType = instance.GetType(); PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == behavior.Property); @@ -185,7 +185,7 @@ namespace Tizen.NUI AnimationBehavior behavior = null; behaviors.TryGetValue(behaviorKey, out behavior); - if (null != behavior) + if (null != instance && null != behavior) { var elementType = instance.GetType(); PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == behavior.Property); -- 2.7.4