.NET: Fix code analysis warnings
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d45383b6 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d45383b6 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d45383b6 Branch: refs/heads/ignite-2788 Commit: d45383b69cc68c0ec967ebd673b197e437720214 Parents: bfdb5c3 Author: Pavel Tupitsyn <[email protected]> Authored: Tue Oct 4 18:48:25 2016 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Tue Oct 4 18:48:25 2016 +0300 ---------------------------------------------------------------------- .../dotnet/Apache.Ignite.Core/Common/JavaException.cs | 1 + .../dotnet/Apache.Ignite.Core/IgniteConfiguration.cs | 1 + .../dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs | 5 ++++- .../dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs | 10 ++++++++-- .../Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs | 5 ++++- .../Impl/Unmanaged/UnmanagedCallbacks.cs | 1 + 6 files changed, 19 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/d45383b6/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs index a634010..5f7ba66 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs @@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Common /// <summary> /// Indicates an error on Java side and contains full Java stack trace. /// </summary> + [Serializable] public class JavaException : IgniteException { /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/d45383b6/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs index 7652092..b045c5a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs @@ -748,6 +748,7 @@ /// </summary> /// <param name="xml">Xml string.</param> /// <returns>Deserialized instance.</returns> + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] public static IgniteConfiguration FromXml(string xml) { IgniteArgumentCheck.NotNullOrEmpty(xml, "xml"); http://git-wip-us.apache.org/repos/asf/ignite/blob/d45383b6/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs index 454f7bb..1f5523c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs @@ -66,7 +66,10 @@ namespace Apache.Ignite.Core.Impl.Compute } catch (TargetInvocationException ex) { - throw ex.InnerException; + if (ex.InnerException != null) + throw ex.InnerException; + + throw; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/d45383b6/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs index 526c445..9fa1377 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs @@ -82,7 +82,10 @@ namespace Apache.Ignite.Core.Impl.Compute } catch (TargetInvocationException ex) { - throw ex.InnerException; + if (ex.InnerException != null) + throw ex.InnerException; + + throw; } } @@ -95,7 +98,10 @@ namespace Apache.Ignite.Core.Impl.Compute } catch (TargetInvocationException ex) { - throw ex.InnerException; + if (ex.InnerException != null) + throw ex.InnerException; + + throw; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/d45383b6/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs index 1867f8c..974ada2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs @@ -70,7 +70,10 @@ namespace Apache.Ignite.Core.Impl.Compute } catch (TargetInvocationException ex) { - throw ex.InnerException; + if (ex.InnerException != null) + throw ex.InnerException; + + throw; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/d45383b6/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs index 493e061..a9de66e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs @@ -1181,6 +1181,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged return SafeCall(() => _log.IsEnabled((LogLevel) level), true); } + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] private static void ConsoleWrite(sbyte* chars, int charsLen, bool isErr) { try
