From 9ae4cb7e3a2937a324dc8b134ecf16a77d30f757 Mon Sep 17 00:00:00 2001 From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Tue, 3 Nov 2020 10:16:33 +0900 Subject: [PATCH] [NUI] Add try-catch block in New function (#2119) - VD Kona : DF200922-00146 - Anlayze the log when the problem is reproduced, after inserting the try-catch block with log. Signed-off-by: huiyu.eun Co-authored-by: dongsug-song <35130733+dongsug-song@users.noreply.github.com> --- src/Tizen.NUI/src/internal/Application.cs | 41 ++++++++++++++++++---- .../src/internal/Interop/NDalicPINVOKE.cs | 4 +++ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/Tizen.NUI/src/internal/Application.cs b/src/Tizen.NUI/src/internal/Application.cs index f1ec214..8dc0eeb 100755 --- a/src/Tizen.NUI/src/internal/Application.cs +++ b/src/Tizen.NUI/src/internal/Application.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -1264,11 +1265,23 @@ namespace Tizen.NUI public static Application New(string[] args, string stylesheet, Application.WindowMode windowMode) { - int argc = args.Length; - string argvStr = string.Join(" ", args); - - Application ret = new Application(NDalicPINVOKE.Application_New__MANUAL_4(argc, argvStr, stylesheet, (int)windowMode), true); + Application ret = null; + int argc = 0; + string argvStr = ""; + try + { + argc = args.Length; + argvStr = string.Join(" ", args); + } + catch (Exception exception) + { + Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, msg : " + exception.Message); + Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber()); + Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace); + throw; + } + ret = new Application(NDalicPINVOKE.Application_New__MANUAL_4(argc, argvStr, stylesheet, (int)windowMode), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -1283,11 +1296,25 @@ namespace Tizen.NUI public static Application New(string[] args, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize) { - int argc = args.Length; - string argvStr = string.Join(" ", args); + Application ret = null; + int argc = 0; + string argvStr = ""; + try + { + argc = args.Length; + argvStr = string.Join(" ", args); + } + catch (Exception exception) + { + Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, msg : " + exception.Message); + Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber()); + Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace); + throw; + } - Application ret = new Application(NDalicPINVOKE.Application_New_WithWindowSizePosition(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true); + ret = new Application(NDalicPINVOKE.Application_New_WithWindowSizePosition(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } diff --git a/src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs b/src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs index 9d6a315..c104c1a 100755 --- a/src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs @@ -193,6 +193,10 @@ namespace Tizen.NUI } } } + if (e == null) + { + e = new global::System.ApplicationException($"FATAL: Exception e is null, numExceptionsPending : {numExceptionsPending}"); + } return e; } } -- 2.7.4