From: hjhun <36876573+hjhun@users.noreply.github.com> Date: Wed, 6 Sep 2023 05:42:24 +0000 (+0900) Subject: [Applications.Common] Remove warning messages (#5532) X-Git-Tag: submit/tizen/20230906.151059~1^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5efb856c61ace8ba2303355fd31c86254b4d1a91;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Applications.Common] Remove warning messages (#5532) Signed-off-by: Hwankyu Jhun --- diff --git a/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/DefaultCoreBackend.cs b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/DefaultCoreBackend.cs index 3c3c046de..85ffca8fc 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/DefaultCoreBackend.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/DefaultCoreBackend.cs @@ -76,7 +76,9 @@ namespace Tizen.Applications.CoreBackend /// /// 3 [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CA1051 protected IDictionary Handlers = new Dictionary(); +#pragma warning restore CA1051 /// /// Constructor of DefaultCoreBackend class. @@ -131,7 +133,9 @@ namespace Tizen.Applications.CoreBackend /// Exits the mainloop of the backend. /// /// 3 +#pragma warning disable CA1716 public abstract void Exit(); +#pragma warning restore CA1716 /// /// Releases all resources. diff --git a/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/ICoreBackend.cs b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/ICoreBackend.cs index 95c37750a..438c2a4fc 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/ICoreBackend.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/ICoreBackend.cs @@ -52,6 +52,8 @@ namespace Tizen.Applications.CoreBackend /// Exits the mainloop of the backend. /// /// 3 +#pragma warning disable CA1716 void Exit(); +#pragma warning restore CA1716 } } diff --git a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/AppNotFoundException.cs b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/AppNotFoundException.cs index 1bda744db..6bd9eb699 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/AppNotFoundException.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/AppNotFoundException.cs @@ -6,7 +6,9 @@ namespace Tizen.Applications.Exceptions /// The class that represents the exception which will be thrown when the application to run is not found /// /// 4 +#pragma warning disable CA1032 public class AppNotFoundException : InvalidOperationException +#pragma warning restore CA1032 { /// /// Constructor diff --git a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchFailedException.cs b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchFailedException.cs index 4cc61f528..4ea15c920 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchFailedException.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchFailedException.cs @@ -6,7 +6,9 @@ namespace Tizen.Applications.Exceptions /// The class that represents the exception which will be thrown when the request failed to launch the application /// /// 4 +#pragma warning disable CA1032 public class LaunchFailedException : InvalidOperationException +#pragma warning restore CA1032 { /// /// Constructor diff --git a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchRejectedException.cs b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchRejectedException.cs index bb6b8553e..e49f587ca 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchRejectedException.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchRejectedException.cs @@ -6,7 +6,9 @@ namespace Tizen.Applications.Exceptions /// The class that represents the exception which will be thrown when the launch request is rejected /// /// 4 +#pragma warning disable CA1032 public class LaunchRejectedException : InvalidOperationException +#pragma warning restore CA1032 { /// /// Constructor diff --git a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/OutOfMemoryException.cs b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/OutOfMemoryException.cs index b67b92e20..a07c2d0c4 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/OutOfMemoryException.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/OutOfMemoryException.cs @@ -8,7 +8,9 @@ namespace Tizen.Applications.Exceptions /// The class that represents the exception which will be thrown when the memory is insufficient /// /// 4 +#pragma warning disable CA1032 public class OutOfMemoryException : InvalidOperationException +#pragma warning restore CA1032 { /// /// Constructor diff --git a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/PermissionDeniedException.cs b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/PermissionDeniedException.cs index 69b60f86d..bd0f76587 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/PermissionDeniedException.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.Exceptions/PermissionDeniedException.cs @@ -6,7 +6,9 @@ namespace Tizen.Applications.Exceptions /// The class that represents the exception which will be thrown when the permission is denied /// /// 4 +#pragma warning disable CA1032 public class PermissionDeniedException : InvalidOperationException +#pragma warning restore CA1032 { /// /// Constructor diff --git a/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Exceptions.cs b/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Exceptions.cs index c30ec1d34..bdffbeab4 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Exceptions.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Exceptions.cs @@ -22,6 +22,7 @@ namespace Tizen.Applications.RPCPort /// Exception class for invalid IO. /// /// 5 + #pragma warning disable CA1032 public class InvalidIOException : InvalidOperationException { } /// @@ -53,4 +54,5 @@ namespace Tizen.Applications.RPCPort /// /// 5 public class InvalidCallbackException : InvalidOperationException { } +#pragma warning restore CA1032 } diff --git a/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Parcel.cs b/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Parcel.cs index 132b65b4a..9923019a7 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Parcel.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Parcel.cs @@ -335,6 +335,11 @@ namespace Tizen.Applications.RPCPort /// 5 public void WriteBundle(Bundle b) { + if (b == null) + { + return; + } + Interop.LibRPCPort.Parcel.WriteBundle(_handle, b.SafeBundleHandle.DangerousGetHandle()); } @@ -472,6 +477,11 @@ namespace Tizen.Applications.RPCPort /// 5 public void Write(byte[] bytes) { + if (bytes == null) + { + return; + } + Interop.LibRPCPort.Parcel.Write(_handle, bytes, bytes.Length); } @@ -508,7 +518,9 @@ namespace Tizen.Applications.RPCPort #region IDisposable Support private bool disposedValue = false; +#pragma warning disable CA1063 private void Dispose(bool disposing) +#pragma warning restore CA1063 { if (!disposedValue) { diff --git a/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/ProxyBase.cs b/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/ProxyBase.cs index edaabfa73..3206c52f2 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/ProxyBase.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/ProxyBase.cs @@ -34,7 +34,9 @@ namespace Tizen.Applications.RPCPort /// Gets Port object. /// /// 5 +#pragma warning disable CA1721 protected Port Port { get; private set; } +#pragma warning restore CA1721 /// /// Gets Port object for asynchronous events. diff --git a/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/StubBase.cs b/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/StubBase.cs index 77d251ec0..8e9c13a80 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/StubBase.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications.RPCPort/StubBase.cs @@ -79,7 +79,10 @@ namespace Tizen.Applications.RPCPort protected void AddPrivilege(string privilege) { if (privilege == null) - throw new ArgumentNullException(); + { + throw new ArgumentNullException(nameof(privilege)); + } + Interop.LibRPCPort.Stub.AddPrivilege(_stub, privilege); } diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs index 193e427ab..3bd02e21e 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs @@ -294,7 +294,9 @@ namespace Tizen.Applications /// /// /// 3 +#pragma warning disable CA1056 public string Uri +#pragma warning restore CA1056 { get { @@ -535,7 +537,7 @@ namespace Tizen.Applications { if (control == null) { - throw new ArgumentNullException("control"); + throw new ArgumentNullException(nameof(control)); } List ids = new List(); @@ -654,7 +656,7 @@ namespace Tizen.Applications { if (launchRequest == null) { - throw new ArgumentNullException("launchRequest"); + throw new ArgumentNullException(nameof(launchRequest)); } Interop.AppControl.ErrorCode err; @@ -736,7 +738,7 @@ namespace Tizen.Applications { if (launchRequest == null) { - throw new ArgumentNullException("launchRequest"); + throw new ArgumentNullException(nameof(launchRequest)); } Interop.AppControl.ErrorCode err; @@ -806,7 +808,7 @@ namespace Tizen.Applications { if (terminateRequest == null) { - throw new ArgumentNullException("terminateRequest"); + throw new ArgumentNullException(nameof(terminateRequest)); } Interop.AppControl.ErrorCode err; @@ -1062,7 +1064,9 @@ namespace Tizen.Applications /// Class for extra data. /// /// 3 +#pragma warning disable CA1034 public class ExtraDataCollection +#pragma warning restore CA1034 { private readonly SafeAppControlHandle _handle; @@ -1092,11 +1096,11 @@ namespace Tizen.Applications { if (string.IsNullOrEmpty(key)) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } if (string.IsNullOrEmpty(value)) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException(nameof(value)); } Interop.AppControl.ErrorCode err = Interop.AppControl.AddExtraData(_handle, key, value); if (err != Interop.AppControl.ErrorCode.None) @@ -1135,11 +1139,11 @@ namespace Tizen.Applications { if (string.IsNullOrEmpty(key)) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException(nameof(value)); } string[] valueArray = value.ToArray(); Interop.AppControl.ErrorCode err = Interop.AppControl.AddExtraDataArray(_handle, key, valueArray, valueArray.Length); @@ -1277,7 +1281,7 @@ namespace Tizen.Applications { if (string.IsNullOrEmpty(key)) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } Interop.AppControl.GetExtraData(_handle, key, out value); if (value != null) @@ -1319,7 +1323,7 @@ namespace Tizen.Applications { if (string.IsNullOrEmpty(key)) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } IntPtr valuePtr = IntPtr.Zero; int len = -1; @@ -1331,9 +1335,9 @@ namespace Tizen.Applications { IntPtr charArr = Marshal.ReadIntPtr(valuePtr, IntPtr.Size * i); stringList.Add(Marshal.PtrToStringAnsi(charArr)); - Interop.Libc.Free(charArr); + _ = Interop.Libc.Free(charArr); } - Interop.Libc.Free(valuePtr); + _ = Interop.Libc.Free(valuePtr); value = stringList; return true; } @@ -1362,7 +1366,7 @@ namespace Tizen.Applications { if (string.IsNullOrEmpty(key)) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } Interop.AppControl.ErrorCode err = Interop.AppControl.RemoveExtraData(_handle, key); if (err != Interop.AppControl.ErrorCode.None) @@ -1416,7 +1420,7 @@ namespace Tizen.Applications { if (string.IsNullOrEmpty(key)) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } bool isArray = false; Interop.AppControl.ErrorCode err = Interop.AppControl.IsExtraDataArray(_handle, key, out isArray); @@ -1431,7 +1435,7 @@ namespace Tizen.Applications { if (string.IsNullOrEmpty(key)) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } string value = string.Empty; Interop.AppControl.ErrorCode err = Interop.AppControl.GetExtraData(_handle, key, out value); @@ -1458,7 +1462,7 @@ namespace Tizen.Applications { if (string.IsNullOrEmpty(key)) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } IntPtr valuePtr = IntPtr.Zero; int len = -1; @@ -1487,9 +1491,9 @@ namespace Tizen.Applications { IntPtr charArr = Marshal.ReadIntPtr(valuePtr, IntPtr.Size * i); valueArray.Add(Marshal.PtrToStringAnsi(charArr)); - Interop.Libc.Free(charArr); + _ = Interop.Libc.Free(charArr); } - Interop.Libc.Free(valuePtr); + _ = Interop.Libc.Free(valuePtr); } return valueArray; } diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControlLaunchMode.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControlLaunchMode.cs index f9165c389..cfaf37419 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/AppControlLaunchMode.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControlLaunchMode.cs @@ -25,7 +25,9 @@ namespace Tizen.Applications /// /// Prefer to launch an application as a single mode. /// +#pragma warning disable CA1720 Single = 0, +#pragma warning restore CA1720 /// /// Prefer to launch an application as a group mode. diff --git a/src/Tizen.Applications.Common/Tizen.Applications/Application.cs b/src/Tizen.Applications.Common/Tizen.Applications/Application.cs index dd21e5b8e..343780f19 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/Application.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/Application.cs @@ -120,7 +120,7 @@ namespace Tizen.Applications { if (args == null) { - throw new ArgumentNullException("args"); + throw new ArgumentNullException(nameof(args)); } s_CurrentApplication = this; } @@ -129,7 +129,9 @@ namespace Tizen.Applications /// Exits the main loop of the application. /// /// 3 +#pragma warning disable CA1716 public abstract void Exit(); +#pragma warning restore CA1716 #region IDisposable Support private bool _disposedValue = false; // To detect redundant calls diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfo.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfo.cs index 1f4472bfe..856544b3e 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfo.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfo.cs @@ -452,7 +452,7 @@ namespace Tizen.Applications }; IntPtr infoHandle = GetInfoHandle(); - if (infoHandle != null) + if (infoHandle != IntPtr.Zero) { err = Interop.ApplicationManager.AppInfoForeachResControl(infoHandle, _resControlCallback, IntPtr.Zero); if (err != Interop.ApplicationManager.ErrorCode.None) @@ -509,7 +509,9 @@ namespace Tizen.Applications GC.SuppressFinalize(this); } +#pragma warning disable CA1063 private void Dispose(bool disposing) +#pragma warning restore CA1063 { if (_disposed) return; diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoFilter.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoFilter.cs index 877d95123..ee53e6bf8 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoFilter.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoFilter.cs @@ -38,7 +38,9 @@ namespace Tizen.Applications /// This class is a possible value to use in the InstalledApplicationFilter. /// /// 5 +#pragma warning disable CA1034 public static class Values +#pragma warning restore CA1034 { /// /// A pre-defined value string for InstalledStorage key. This value indicates that the application is installed at internal storage. @@ -63,7 +65,9 @@ namespace Tizen.Applications /// This class is a possible key to use in the InstalledApplicationFilter. /// /// 3 +#pragma warning disable CA1034 public static class Keys +#pragma warning restore CA1034 { /// /// A key to filter by application id. diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs index 2df878596..21abc91d8 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs @@ -217,6 +217,11 @@ namespace Tizen.Applications /// 6 public static void TerminateBackgroundApplication(ApplicationRunningContext app) { + if (app == null) + { + throw new ArgumentException("Invalid argument."); + } + ErrorCode err = Interop.ApplicationManager.AppManagerRequestTerminateBgApp(app._contextHandle); if (err != Interop.ApplicationManager.ErrorCode.None) { diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationRunningContext.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationRunningContext.cs index 9c791e974..e93d57093 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationRunningContext.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationRunningContext.cs @@ -347,7 +347,11 @@ namespace Tizen.Applications GC.SuppressFinalize(this); } +#pragma warning disable CA1801 +#pragma warning disable CA1063 private void Dispose(bool disposing) +#pragma warning restore CA1063 +#pragma warning restore CA1801 { if (_disposed) return; diff --git a/src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs b/src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs index aa63d9ddf..61960542d 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs @@ -227,7 +227,7 @@ namespace Tizen.Applications { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException(nameof(value)); } AddItem(key, value, 0, value.Length); } @@ -257,19 +257,19 @@ namespace Tizen.Applications { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException(nameof(value)); } if (offset < 0) { - throw new ArgumentOutOfRangeException("offset", offset, "Cannot be less than 0"); + throw new ArgumentOutOfRangeException(nameof(offset), offset, "Cannot be less than 0"); } if (offset > value.Length - 1) { - throw new ArgumentOutOfRangeException("offset", offset, "Greater than last index of array"); + throw new ArgumentOutOfRangeException(nameof(offset), offset, "Greater than last index of array"); } if (count < 1) { - throw new ArgumentOutOfRangeException("count", count, "Must be at least 1"); + throw new ArgumentOutOfRangeException(nameof(count), count, "Must be at least 1"); } if (offset + count > value.Length) { @@ -282,7 +282,7 @@ namespace Tizen.Applications } else { - throw new ArgumentException("Key already exists", "key"); + throw new ArgumentException("Key already exists", nameof(key)); } } @@ -310,7 +310,7 @@ namespace Tizen.Applications } else { - throw new ArgumentException("Key already exists", "key"); + throw new ArgumentException("Key already exists", nameof(key)); } } @@ -334,13 +334,13 @@ namespace Tizen.Applications if (!_keys.Contains(key)) { string[] valueArray = value.Select(v => v == null ? string.Empty : v).ToArray(); - int ret = Interop.Bundle.AddStringArray(_handle, key, valueArray, valueArray.Count()); + int ret = Interop.Bundle.AddStringArray(_handle, key, valueArray, valueArray.Length); BundleErrorFactory.CheckAndThrowException(ret, _handle); _keys.Add(key); } else { - throw new ArgumentException("Key already exists", "key"); + throw new ArgumentException("Key already exists", nameof(key)); } } @@ -405,12 +405,12 @@ namespace Tizen.Applications return byteArray; default: - throw new ArgumentException("Key does not exist in the bundle", "key"); + throw new ArgumentException("Key does not exist in the bundle", nameof(key)); } } else { - throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", "key"); + throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", nameof(key)); } } @@ -609,12 +609,12 @@ namespace Tizen.Applications return typeof(byte[]) == typeof(T); default: - throw new ArgumentException("Key does not exist in the bundle", "key"); + throw new ArgumentException("Key does not exist in the bundle", nameof(key)); } } else { - throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", "key"); + throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", nameof(key)); } } @@ -676,6 +676,11 @@ namespace Tizen.Applications { SafeBundleHandle handle; + if (bundleRaw == null) + { + throw new ArgumentException("Invalid bundle raw"); + } + handle = Interop.Bundle.BundleDecode(bundleRaw, bundleRaw.Length); if (ErrorFacts.GetLastResult() == (int)BundleErrorFactory.BundleError.InvalidParameter) { diff --git a/src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs b/src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs index c9725ae14..4bda902a6 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs @@ -205,6 +205,12 @@ namespace Tizen.Applications /// 3 protected virtual void OnAppControlReceived(AppControlReceivedEventArgs e) { + if (e == null) + { + Log.Error(LogTag, "e is null"); + return; + } + AppControlReceived?.Invoke(this, e); } @@ -216,6 +222,12 @@ namespace Tizen.Applications /// 3 protected virtual void OnLowMemory(LowMemoryEventArgs e) { + if (e == null) + { + Log.Error(LogTag, "e is null"); + return; + } + LowMemory?.Invoke(this, e); if (e.LowMemoryStatus == LowMemoryStatus.SoftWarning || e.LowMemoryStatus == LowMemoryStatus.HardWarning) { @@ -231,6 +243,12 @@ namespace Tizen.Applications /// 3 protected virtual void OnLowBattery(LowBatteryEventArgs e) { + if (e == null) + { + Log.Error(LogTag, "e is null"); + return; + } + LowBattery?.Invoke(this, e); } @@ -242,6 +260,12 @@ namespace Tizen.Applications /// 3 protected virtual void OnLocaleChanged(LocaleChangedEventArgs e) { + if (e == null) + { + Log.Error(LogTag, "e is null"); + return; + } + if (!GlobalizationMode.Invariant) { ChangeCurrentUICultureInfo(e.Locale); @@ -258,6 +282,12 @@ namespace Tizen.Applications /// 3 protected virtual void OnRegionFormatChanged(RegionFormatChangedEventArgs e) { + if (e == null) + { + Log.Error(LogTag, "e is null"); + return; + } + if (!GlobalizationMode.Invariant) { ChangeCurrentCultureInfo(e.Region); diff --git a/src/Tizen.Applications.Common/Tizen.Applications/CultureInfoHelper.cs b/src/Tizen.Applications.Common/Tizen.Applications/CultureInfoHelper.cs index ba586cc4c..8dac6fe78 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications/CultureInfoHelper.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/CultureInfoHelper.cs @@ -39,7 +39,9 @@ namespace Tizen.Applications } string cultureName = string.Empty; +#pragma warning disable CA1308 string key = "CultureInfo:" + locale.ToLowerInvariant(); +#pragma warning restore CA1308 IntPtr value = Interop.LibIniParser.GetString(dictionary, key, IntPtr.Zero); if (value != IntPtr.Zero) { diff --git a/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs b/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs index 60970a83f..ae8b6b81f 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs @@ -25,6 +25,7 @@ namespace Tizen.Applications /// /// The device orientation is 0. /// +#pragma warning disable CA1707 Orientation_0 = 0, /// @@ -41,5 +42,6 @@ namespace Tizen.Applications /// The device orientation is 270. /// Orientation_270 = 270, +#pragma warning restore CA1707 } } \ No newline at end of file diff --git a/src/Tizen.Applications.Common/Tizen.Applications/GSourceManager.cs b/src/Tizen.Applications.Common/Tizen.Applications/GSourceManager.cs index 00dc4c9ca..f09843f87 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications/GSourceManager.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/GSourceManager.cs @@ -21,18 +21,10 @@ namespace Tizen.Applications { internal static class GSourceManager { - private static Interop.Glib.GSourceFunc _wrapperHandler; - private static Object _transactionLock; - private static ConcurrentDictionary _handlerMap; - private static int _transactionId; - - static GSourceManager() - { - _wrapperHandler = new Interop.Glib.GSourceFunc(Handler); - _transactionLock = new Object(); - _handlerMap = new ConcurrentDictionary(); - _transactionId = 0; - } + private static Interop.Glib.GSourceFunc _wrapperHandler = new Interop.Glib.GSourceFunc(Handler); + private static Object _transactionLock = new Object(); + private static ConcurrentDictionary _handlerMap = new ConcurrentDictionary(); + private static int _transactionId = 0; public static void Post(Action action, bool useTizenGlibContext = false) { @@ -44,7 +36,7 @@ namespace Tizen.Applications _handlerMap.TryAdd(id, action); IntPtr source = Interop.Glib.IdleSourceNew(); Interop.Glib.SourceSetCallback(source, _wrapperHandler, (IntPtr)id, IntPtr.Zero); - Interop.Glib.SourceAttach(source, useTizenGlibContext ? Interop.AppCoreUI.GetTizenGlibContext() : IntPtr.Zero); + _ = Interop.Glib.SourceAttach(source, useTizenGlibContext ? Interop.AppCoreUI.GetTizenGlibContext() : IntPtr.Zero); Interop.Glib.SourceUnref(source); } diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ReceivedAppControl.cs b/src/Tizen.Applications.Common/Tizen.Applications/ReceivedAppControl.cs index e1378114e..22c8d1587 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/ReceivedAppControl.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/ReceivedAppControl.cs @@ -142,7 +142,7 @@ namespace Tizen.Applications { if (replyRequest == null) { - throw new ArgumentNullException("replyRequest"); + throw new ArgumentNullException(nameof(replyRequest)); } Interop.AppControl.ErrorCode err = Interop.AppControl.ReplyToLaunchRequest(replyRequest.SafeAppControlHandle, this.SafeAppControlHandle, (int)result); if (err != Interop.AppControl.ErrorCode.None) diff --git a/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationControl.cs b/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationControl.cs index db2fdc6e5..5ca9390a6 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationControl.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationControl.cs @@ -28,8 +28,6 @@ namespace Tizen.Applications [EditorBrowsable(EditorBrowsableState.Never)] public class RecentApplicationControl { - private const string LogTag = "Tizen.Applications"; - private readonly string _pkgId; internal RecentApplicationControl(String pkgId) diff --git a/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationInfo.cs b/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationInfo.cs index 88dd7766f..b65d51f30 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationInfo.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationInfo.cs @@ -27,8 +27,6 @@ namespace Tizen.Applications [EditorBrowsable(EditorBrowsableState.Never)] public class RecentApplicationInfo : ApplicationInfo { - private const string LogTag = "Tizen.Applications"; - /// /// Gets the instance ID. /// @@ -51,7 +49,9 @@ namespace Tizen.Applications /// Gets the URI. /// /// 3 +#pragma warning disable CA1056 public string Uri { get; private set; } +#pragma warning restore CA1056 /// /// Gets the launchTime. diff --git a/src/Tizen.Applications.Common/Tizen.Applications/SafeBundleHandle.cs b/src/Tizen.Applications.Common/Tizen.Applications/SafeBundleHandle.cs index cd09b04b9..6a20a4311 100644 --- a/src/Tizen.Applications.Common/Tizen.Applications/SafeBundleHandle.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/SafeBundleHandle.cs @@ -59,7 +59,7 @@ namespace Tizen.Applications /// true if the handle is released successfully. protected override bool ReleaseHandle() { - Interop.Bundle.DangerousFree(this.handle); + _ = Interop.Bundle.DangerousFree(this.handle); this.SetHandle(IntPtr.Zero); return true; } diff --git a/src/Tizen.Applications.Common/Tizen.Applications/TizenSynchronizationContext.cs b/src/Tizen.Applications.Common/Tizen.Applications/TizenSynchronizationContext.cs index 3d3495cb3..dd2eb3fe7 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications/TizenSynchronizationContext.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/TizenSynchronizationContext.cs @@ -72,6 +72,7 @@ namespace Tizen.Applications Exception err = null; GSourceManager.Post(() => { +#pragma warning disable CA1031 try { d(state); @@ -84,6 +85,7 @@ namespace Tizen.Applications { mre.Set(); } +#pragma warning restore CA1031 }); mre.WaitOne(); if (err != null) diff --git a/src/Tizen.Applications.Common/Tizen.Applications/TizenUISynchronizationContext.cs b/src/Tizen.Applications.Common/Tizen.Applications/TizenUISynchronizationContext.cs index 7998fee8c..459be3a0b 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications/TizenUISynchronizationContext.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/TizenUISynchronizationContext.cs @@ -74,6 +74,7 @@ namespace Tizen.Applications Exception err = null; GSourceManager.Post(() => { +#pragma warning disable CA1031 try { d(state); @@ -86,6 +87,7 @@ namespace Tizen.Applications { mre.Set(); } +#pragma warning restore CA1031 }, true); mre.WaitOne(); if (err != null)