[NUI] Catch exception when Tizen.System.SystemSettings throw excpetion
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 16 Apr 2025 08:50:03 +0000 (17:50 +0900)
committerSangHyeon Jade Lee <dltkdgus1764@gmail.com>
Thu, 17 Apr 2025 07:55:55 +0000 (16:55 +0900)
There was some exception throwing at some targets s.t. SystemSettings not supported.

If then, we should not do anything after those exception occured.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/internal/Common/SystemFontSizeChangedManager.cs
src/Tizen.NUI/src/internal/Common/SystemFontTypeChangedManager.cs
src/Tizen.NUI/src/internal/Common/SystemLocaleLanguageChangedManager.cs
src/Tizen.NUI/src/public/Visuals/VisualObject/AdvancedTextVisual.cs

index b032a4c5899020b1ef1298679006b4b771bfc462..b3024d2d652f70f09ca26e561760c8b42df7da3f 100644 (file)
@@ -34,7 +34,15 @@ namespace Tizen.NUI
 
         static SystemFontSizeChangedManager()
         {
-            SystemSettings.FontSizeChanged += SystemFontSizeChanged;
+            try
+            {
+                SystemSettings.FontSizeChanged += SystemFontSizeChanged;
+            }
+            catch(Exception e)
+            {
+                Tizen.Log.Info("NUI", $"{e} Exception caught! SystemFontSizeChanged will not be detected!\n");
+                fontSize = SystemSettingsFontSize.Normal;
+            }
         }
 
         /// <summary>
index aba4bbabc19b333c2c50794889c5b4d0cc9594c3..3a8b5b60578015b5cbf1f87bc191cfabcc7e5e9c 100644 (file)
@@ -35,7 +35,15 @@ namespace Tizen.NUI
 
         static SystemFontTypeChangedManager()
         {
-            SystemSettings.FontTypeChanged += SystemFontTypeChanged;
+            try
+            {
+                SystemSettings.FontTypeChanged += SystemFontTypeChanged;
+            }
+            catch(Exception e)
+            {
+                Tizen.Log.Info("NUI", $"{e} Exception caught! SystemFontTypeChanged will not be detected!\n");
+                fontType = defaultFontType;
+            }
         }
 
         /// <summary>
index c440494ae8701261effa536409602af016f27ba5..011a59c3a5767adf7e3630ec5709b8fd823e6647 100644 (file)
@@ -35,7 +35,15 @@ namespace Tizen.NUI
 
         static SystemLocaleLanguageChangedManager()
         {
-            SystemSettings.LocaleLanguageChanged += SystemLocaleLanguageChanged;
+            try
+            {
+                SystemSettings.LocaleLanguageChanged += SystemLocaleLanguageChanged;
+            }
+            catch(Exception e)
+            {
+                Tizen.Log.Info("NUI", $"{e} Exception caught! SystemLocaleLangeChanged will not be detected!\n");
+                localeLanguage = defaultLocaleLanguage;
+            }
         }
 
         /// <summary>
index cee81c7d3dfe90d42499a83c9a5845f2680fcb96..8336d01ab23eb14d18e708e2dbcb135e4a8d2b7c 100644 (file)
@@ -68,7 +68,15 @@ namespace Tizen.NUI.Visuals
                 }
                 string translatableText = null;
                 textLabelSid = value;
-                translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new global::System.Globalization.CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
+                try
+                {
+                    translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new global::System.Globalization.CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
+                }
+                catch(global::System.Exception e)
+                {
+                    Tizen.Log.Info("NUI", $"{e} Exception caught! Translate {value} failed!\n");
+                    translatableText = null;
+                }
 
                 if (translatableText != null)
                 {