From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Tue, 3 Nov 2020 01:16:33 +0000 (+0900) Subject: [NUI] Add try-catch block in New function (#2119) X-Git-Tag: submit/tizen_5.5/20201105.005409~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=603ea627abcbaaf423cf5ab18a0e2b04ea1b3534;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [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> --- diff --git a/src/Tizen.NUI/src/internal/Application.cs b/src/Tizen.NUI/src/internal/Application.cs index accce45..257dba8 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; @@ -1256,11 +1257,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; @@ -1275,11 +1288,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; } }