.NET: Suppress some false VS2017 warnings
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5ca7909f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5ca7909f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5ca7909f Branch: refs/heads/ignite-6305 Commit: 5ca7909fdfb129eed1a58650f57d7dd968b1e287 Parents: 7aaacd8 Author: Pavel Tupitsyn <ptupit...@apache.org> Authored: Mon Oct 2 16:34:12 2017 +0300 Committer: Pavel Tupitsyn <ptupit...@apache.org> Committed: Mon Oct 2 16:34:12 2017 +0300 ---------------------------------------------------------------------- modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs | 2 ++ .../Apache.Ignite.Core/Impl/Cache/Query/QueryCursorBase.cs | 3 +++ .../Impl/Client/Cache/Query/ClientQueryCursor.cs | 3 +++ .../dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs | 2 ++ .../dotnet/Apache.Ignite.Core/Impl/PlatformJniTarget.cs | 6 ++++++ .../Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs | 1 + 6 files changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/5ca7909f/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs index 886dee9..4e5eae5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs @@ -454,6 +454,8 @@ namespace Apache.Ignite.Core /// </summary> /// <param name="interopProc">Interop processor.</param> /// <param name="stream">Stream.</param> + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", + Justification = "PlatformJniTarget is passed further")] internal static void OnStart(IUnmanagedTarget interopProc, IBinaryStream stream) { try http://git-wip-us.apache.org/repos/asf/ignite/blob/5ca7909f/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/QueryCursorBase.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/QueryCursorBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/QueryCursorBase.cs index 8f00a2e..216d7ea 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/QueryCursorBase.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/QueryCursorBase.cs @@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query using System.Collections; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using Apache.Ignite.Core.Cache.Query; using Apache.Ignite.Core.Impl.Binary; using Apache.Ignite.Core.Impl.Binary.IO; @@ -63,6 +64,8 @@ namespace Apache.Ignite.Core.Impl.Cache.Query /// <param name="marsh">Marshaller.</param> /// <param name="keepBinary">Keep binary flag.</param> /// <param name="initialBatchStream">Optional stream with initial batch.</param> + [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", + Justification = "ConvertGetBatch calls Read, which does not rely on constructor being run.")] protected QueryCursorBase(Marshaller marsh, bool keepBinary, IBinaryStream initialBatchStream = null) { Debug.Assert(marsh != null); http://git-wip-us.apache.org/repos/asf/ignite/blob/5ca7909f/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/Query/ClientQueryCursor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/Query/ClientQueryCursor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/Query/ClientQueryCursor.cs index 898bbbe..75aa5df 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/Query/ClientQueryCursor.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/Query/ClientQueryCursor.cs @@ -18,6 +18,8 @@ namespace Apache.Ignite.Core.Impl.Client.Cache.Query { using System.Collections.Generic; + using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; using Apache.Ignite.Core.Cache; using Apache.Ignite.Core.Impl.Binary; @@ -65,6 +67,7 @@ namespace Apache.Ignite.Core.Impl.Client.Cache.Query } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] protected override ICacheEntry<TK, TV> Read(BinaryReader reader) { return new CacheEntry<TK, TV>(reader.ReadObject<TK>(), reader.ReadObject<TV>()); http://git-wip-us.apache.org/repos/asf/ignite/blob/5ca7909f/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs index 4eb53dd..e565f31 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs @@ -201,6 +201,8 @@ namespace Apache.Ignite.Core.Impl.Client /// <summary> /// Connects the socket. /// </summary> + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", + Justification = "Socket is returned from this method.")] private static Socket Connect(IgniteClientConfiguration cfg) { List<Exception> errors = null; http://git-wip-us.apache.org/repos/asf/ignite/blob/5ca7909f/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformJniTarget.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformJniTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformJniTarget.cs index 725c112..c7d9ab4 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformJniTarget.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformJniTarget.cs @@ -174,6 +174,7 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] public unsafe TR InObjectStreamOutObjectStream<TR>(int type, Action<IBinaryStream> writeAction, Func<IBinaryStream, IPlatformTargetInternal, TR> readAction, IPlatformTargetInternal arg) { @@ -244,6 +245,7 @@ namespace Apache.Ignite.Core.Impl /// <param name="keepBinary">Keep binary flag, only applicable to object futures. False by default.</param> /// <param name="convertFunc">The function to read future result from stream.</param> /// <returns>Created future.</returns> + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] private Future<T> GetFuture<T>(Func<long, int, IUnmanagedTarget> listenAction, bool keepBinary = false, Func<BinaryReader, T> convertFunc = null) { @@ -325,6 +327,7 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] public long InStreamOutLong(int type, Action<IBinaryRawWriter> writeAction) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) @@ -340,6 +343,7 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] public T InStreamOutStream<T>(int type, Action<IBinaryRawWriter> writeAction, Func<IBinaryRawReader, T> readAction) { @@ -361,6 +365,7 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] public IPlatformTarget InStreamOutObject(int type, Action<IBinaryRawWriter> writeAction) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) @@ -429,6 +434,7 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] public T OutStream<T>(int type, Func<IBinaryRawReader, T> readAction) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) http://git-wip-us.apache.org/repos/asf/ignite/blob/5ca7909f/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 b291b3d..37a24b1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs @@ -1210,6 +1210,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged #region AffinityFunction + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] private long AffinityFunctionInit(long memPtr, long unused, long unused1, void* baseFunc) { using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())