[Applications.Common] Remove warning messages (#5532)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Wed, 6 Sep 2023 05:42:24 +0000 (14:42 +0900)
committerGitHub <noreply@github.com>
Wed, 6 Sep 2023 05:42:24 +0000 (14:42 +0900)
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
29 files changed:
src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/DefaultCoreBackend.cs
src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/ICoreBackend.cs
src/Tizen.Applications.Common/Tizen.Applications.Exceptions/AppNotFoundException.cs
src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchFailedException.cs
src/Tizen.Applications.Common/Tizen.Applications.Exceptions/LaunchRejectedException.cs
src/Tizen.Applications.Common/Tizen.Applications.Exceptions/OutOfMemoryException.cs
src/Tizen.Applications.Common/Tizen.Applications.Exceptions/PermissionDeniedException.cs
src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Exceptions.cs
src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Parcel.cs
src/Tizen.Applications.Common/Tizen.Applications.RPCPort/ProxyBase.cs
src/Tizen.Applications.Common/Tizen.Applications.RPCPort/StubBase.cs
src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs
src/Tizen.Applications.Common/Tizen.Applications/AppControlLaunchMode.cs
src/Tizen.Applications.Common/Tizen.Applications/Application.cs
src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfo.cs
src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoFilter.cs
src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs
src/Tizen.Applications.Common/Tizen.Applications/ApplicationRunningContext.cs
src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs
src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs
src/Tizen.Applications.Common/Tizen.Applications/CultureInfoHelper.cs
src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs
src/Tizen.Applications.Common/Tizen.Applications/GSourceManager.cs
src/Tizen.Applications.Common/Tizen.Applications/ReceivedAppControl.cs
src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationControl.cs
src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationInfo.cs
src/Tizen.Applications.Common/Tizen.Applications/SafeBundleHandle.cs
src/Tizen.Applications.Common/Tizen.Applications/TizenSynchronizationContext.cs
src/Tizen.Applications.Common/Tizen.Applications/TizenUISynchronizationContext.cs

index 3c3c046deb27f8c5a5fee8556124aaa79cb721e5..85ffca8fc73dabb570a18ccbfff798ff365468b3 100755 (executable)
@@ -76,7 +76,9 @@ namespace Tizen.Applications.CoreBackend
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         [EditorBrowsable(EditorBrowsableState.Never)]
+#pragma warning disable CA1051
         protected IDictionary<EventType, object> Handlers = new Dictionary<EventType, object>();
+#pragma warning restore CA1051
 
         /// <summary>
         /// Constructor of DefaultCoreBackend class.
@@ -131,7 +133,9 @@ namespace Tizen.Applications.CoreBackend
         /// Exits the mainloop of the backend.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1716
         public abstract void Exit();
+#pragma warning restore CA1716
 
         /// <summary>
         /// Releases all resources.
index 95c37750a965a65861e754de6a712a378b05a5ea..438c2a4fc5cf04a7b71f6b3e4edf623f206d270f 100755 (executable)
@@ -52,6 +52,8 @@ namespace Tizen.Applications.CoreBackend
         /// Exits the mainloop of the backend.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1716
         void Exit();
+#pragma warning restore CA1716
     }
 }
index 1bda744db9e5196f2308d7a07172293b14928bcc..6bd9eb6992c16eff342a1b21df0bfbcf9e8eca11 100755 (executable)
@@ -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
     /// </summary>
     /// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
     public class AppNotFoundException : InvalidOperationException
+#pragma warning restore CA1032
     {
         /// <summary>
         /// Constructor
index 4cc61f5282741973eea868a8b2a60d26dddb37e9..4ea15c92070b4a371764bcb255ac2bde161533a8 100755 (executable)
@@ -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
     /// </summary>
     /// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
     public class LaunchFailedException : InvalidOperationException
+#pragma warning restore CA1032
     {
         /// <summary>
         /// Constructor
index bb6b8553e4489b322ce48b77831e9e4a2efe95f8..e49f587cabc2481c182bcf55cfb796c80a060e38 100755 (executable)
@@ -6,7 +6,9 @@ namespace Tizen.Applications.Exceptions
     /// The class that represents the exception which will be thrown when the launch request is rejected
     /// </summary>
     /// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
     public class LaunchRejectedException : InvalidOperationException
+#pragma warning restore CA1032
     {
         /// <summary>
         /// Constructor
index b67b92e205b009187263a2f82654f5386e78888d..a07c2d0c44d8c0ff29d1114de757a8f83344092b 100755 (executable)
@@ -8,7 +8,9 @@ namespace Tizen.Applications.Exceptions
     /// The class that represents the exception which will be thrown when the memory is insufficient
     /// </summary>
     /// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
     public class OutOfMemoryException : InvalidOperationException
+#pragma warning restore CA1032
     {
         /// <summary>
         /// Constructor
index 69b60f86d1a5247e1190e6adf3f44ae5ba9a913b..bd0f76587e1cfc88703913c817c4ae6f84d8cad4 100755 (executable)
@@ -6,7 +6,9 @@ namespace Tizen.Applications.Exceptions
     /// The class that represents the exception which will be thrown when the permission is denied
     /// </summary>
     /// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
     public class PermissionDeniedException : InvalidOperationException
+#pragma warning restore CA1032
     {
         /// <summary>
         /// Constructor
index c30ec1d34d10ffd16a868bbd9e49df96840bec4a..bdffbeab46c0e9bb68f17d01ed0c514e6143d9a9 100755 (executable)
@@ -22,6 +22,7 @@ namespace Tizen.Applications.RPCPort
     /// Exception class for invalid IO.
     /// </summary>
     /// <since_tizen> 5 </since_tizen>
+ #pragma warning disable CA1032
     public class InvalidIOException : InvalidOperationException { }
 
     /// <summary>
@@ -53,4 +54,5 @@ namespace Tizen.Applications.RPCPort
     /// </summary>
     /// <since_tizen> 5 </since_tizen>
     public class InvalidCallbackException : InvalidOperationException { }
+#pragma warning restore CA1032
 }
index 132b65b4ac56bfe60b3e3e7331afbbbcbe37917b..9923019a73aa4694255212653319c8f0fe4c227f 100755 (executable)
@@ -335,6 +335,11 @@ namespace Tizen.Applications.RPCPort
         /// <since_tizen> 5 </since_tizen>
         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
         /// <since_tizen> 5 </since_tizen>
         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)
             {
index edaabfa73009684324dab3e3d0deacf95336bb08..3206c52f2405c4822fc8f20306d0d21f020b60b6 100755 (executable)
@@ -34,7 +34,9 @@ namespace Tizen.Applications.RPCPort
         /// Gets Port object.
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
+#pragma warning disable CA1721
         protected Port Port { get; private set; }
+#pragma warning restore CA1721
 
         /// <summary>
         /// Gets Port object for asynchronous events.
index 77d251ec0c26bf2ecf615be8baf62aafdf32d409..8e9c13a80ca65489f62b69f5895143d5c22c8668 100755 (executable)
@@ -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);
         }
 
index 193e427ab01daa97e7fc5b4f648018789b5e67fd..3bd02e21ef69778701eb93b34c0f1a3d3a5ec45b 100755 (executable)
@@ -294,7 +294,9 @@ namespace Tizen.Applications
         /// </code>
         /// </example>
         /// <since_tizen> 3 </since_tizen>
+#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<string> ids = new List<string>();
@@ -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.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
+#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;
             }
index f9165c3890e07aca93188075afe4b9238a6bbd19..cfaf3741922c7d602bddf876b5ee8fced3641542 100644 (file)
@@ -25,7 +25,9 @@ namespace Tizen.Applications
         /// <summary>
         /// Prefer to launch an application as a single mode.
         /// </summary>
+#pragma warning disable CA1720
         Single = 0,
+#pragma warning restore CA1720
 
         /// <summary>
         /// Prefer to launch an application as a group mode.
index dd21e5b8eb1046b3acbcd65baeb06503d99b5967..343780f19ce080a5eedbd7cd0668fb73e8c71600 100644 (file)
@@ -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.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1716
         public abstract void Exit();
+#pragma warning restore CA1716
 
         #region IDisposable Support
         private bool _disposedValue = false; // To detect redundant calls
index 1f4472bfe48b879a4a71acfcb986b523860436ff..856544b3eeb3c46a0e64e46c5fb58a9784d0e85a 100644 (file)
@@ -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;
index 877d951237761bbddfc57bb3763fd64c1d698c99..ee53e6bf8fe40a75c70515a41d528d66a8bc3ce0 100644 (file)
@@ -38,7 +38,9 @@ namespace Tizen.Applications
         /// This class is a possible value to use in the InstalledApplicationFilter.
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
+#pragma warning disable CA1034
         public static class Values
+#pragma warning restore CA1034
         {
             /// <summary>
             /// 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.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1034
         public static class Keys
+#pragma warning restore CA1034
         {
             /// <summary>
             /// A key to filter by application id.
index 2df8785969fe4098ea6e0fbc7bf07af9986aedbb..21abc91d8c52dee5fb32fbd71b7a2b2db087152a 100755 (executable)
@@ -217,6 +217,11 @@ namespace Tizen.Applications
         /// <since_tizen> 6 </since_tizen>
         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)
             {
index 9c791e97494907a69b2b74a3eafbb8caa847d979..e93d570936873fe6ccea668566b5e4b5c4930766 100755 (executable)
@@ -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;
index aa63d9ddfb1423253d71ef69b581dc12d9be090b..61960542db289bf60725bdf2c1f1eda5c94f66d2 100644 (file)
@@ -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)
             {
index c9725ae148704901928cf876c35c01cdc1c1b064..4bda902a63db097672b314182530fdc3457a83ad 100644 (file)
@@ -205,6 +205,12 @@ namespace Tizen.Applications
         /// <since_tizen> 3 </since_tizen>
         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
         /// <since_tizen> 3 </since_tizen>
         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
         /// <since_tizen> 3 </since_tizen>
         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
         /// <since_tizen> 3 </since_tizen>
         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
         /// <since_tizen> 3 </since_tizen>
         protected virtual void OnRegionFormatChanged(RegionFormatChangedEventArgs e)
         {
+            if (e == null)
+            {
+                Log.Error(LogTag, "e is null");
+                return;
+            }
+
             if (!GlobalizationMode.Invariant)
             {
                 ChangeCurrentCultureInfo(e.Region);
index ba586cc4c1797cd0f68aafef78ea0dd8d2d8d5bd..8dac6fe787f65ed72508bf4a808f9c2b9ce1ca25 100755 (executable)
@@ -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)
             {
index 60970a83f8258f2a7c6021b6df8ec791777601b1..ae8b6b81fa0c97227fd84b787cc933fde502a949 100644 (file)
@@ -25,6 +25,7 @@ namespace Tizen.Applications
         /// <summary>
         /// The device orientation is 0.
         /// </summary>
+#pragma warning disable CA1707
         Orientation_0 = 0,
 
         /// <summary>
@@ -41,5 +42,6 @@ namespace Tizen.Applications
         /// The device orientation is 270.
         /// </summary>
         Orientation_270 = 270,
+#pragma warning restore CA1707
     }
 }
\ No newline at end of file
index 00dc4c9ca755dc98e6031d94040f2d91c31e0e27..f09843f87585b4e147bab9cdb142c213fc0e3312 100755 (executable)
@@ -21,18 +21,10 @@ namespace Tizen.Applications
 {
     internal static class GSourceManager
     {
-        private static Interop.Glib.GSourceFunc _wrapperHandler;
-        private static Object _transactionLock;
-        private static ConcurrentDictionary<int, Action> _handlerMap;
-        private static int _transactionId;
-
-        static GSourceManager()
-        {
-            _wrapperHandler = new Interop.Glib.GSourceFunc(Handler);
-            _transactionLock = new Object();
-            _handlerMap = new ConcurrentDictionary<int, Action>();
-            _transactionId = 0;
-        }
+        private static Interop.Glib.GSourceFunc _wrapperHandler = new Interop.Glib.GSourceFunc(Handler);
+        private static Object _transactionLock = new Object();
+        private static ConcurrentDictionary<int, Action> _handlerMap = new ConcurrentDictionary<int, Action>();
+        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);
         }
 
index e1378114e3efdbda0ad09562ad3b089fb1288696..22c8d1587bdfcf3107194ff353550cad22e71901 100644 (file)
@@ -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)
index db2fdc6e59618b6b880b1e1c0360f9406e985dad..5ca9390a672c81ed20fa01167a49d29c29094308 100644 (file)
@@ -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)
index 88dd7766f751c07239b410004bd6b26ffe3251d0..b65d51f30416e01173589a5b10a3d012ef70d465 100644 (file)
@@ -27,8 +27,6 @@ namespace Tizen.Applications
     [EditorBrowsable(EditorBrowsableState.Never)]
     public class RecentApplicationInfo : ApplicationInfo
     {
-        private const string LogTag = "Tizen.Applications";
-
         /// <summary>
         /// Gets the instance ID.
         /// </summary>
@@ -51,7 +49,9 @@ namespace Tizen.Applications
         /// Gets the URI.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1056
         public string Uri { get; private set; }
+#pragma warning restore CA1056
 
         /// <summary>
         /// Gets the launchTime.
index cd09b04b9a188d158dfd86ca30815614fa8d8ccf..6a20a4311d61d14aaeee347e87d46c474a2d5bf2 100644 (file)
@@ -59,7 +59,7 @@ namespace Tizen.Applications
         /// <returns>true if the handle is released successfully.</returns>
         protected override bool ReleaseHandle()
         {
-            Interop.Bundle.DangerousFree(this.handle);
+            _ = Interop.Bundle.DangerousFree(this.handle);
             this.SetHandle(IntPtr.Zero);
             return true;
         }
index 3d3495cb3ac0a5c1e7f7c2facc5d39563c3af3ac..dd2eb3fe713fa193f5733487f33b9ccefc70d364 100755 (executable)
@@ -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)
index 7998fee8c7ddd38ad23a117484cb49612f360277..459be3a0b9ad6bd7ba5eec53ee5a7d91cffcb0dc 100755 (executable)
@@ -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)