.NET: Fix gridName in SchemaTest.TestSchemavalidation NuGet test, 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/7a18c3c5 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7a18c3c5 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7a18c3c5 Branch: refs/heads/ignite-3477-master Commit: 7a18c3c52c6a04d2bcbc94d90a364c2b31df3c9c Parents: 117e18e Author: Pavel Tupitsyn <[email protected]> Authored: Wed Mar 22 16:55:02 2017 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Wed Mar 22 16:55:02 2017 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs | 2 +- .../Binary/BinaryArrayEqualityComparer.cs | 5 ++++- .../dotnet/Apache.Ignite.Core/Events/EventBase.cs | 3 +++ .../Impl/Binary/Io/BinaryHeapStream.cs | 3 +++ .../Impl/Memory/PlatformMemoryStream.cs | 4 ++++ .../Impl/Transactions/CacheTransactionManager.cs | 13 +++++++++++++ 6 files changed, 28 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/7a18c3c5/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs index ac48619..1ecb3ed 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs @@ -36,7 +36,7 @@ namespace Apache.Ignite.Core.Tests.NuGet Assert.IsTrue(File.Exists("IgniteConfigurationSection.xsd")); // Valid schema - CheckSchemaValidation(@"<igniteConfiguration xmlns='http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection' gridName='myGrid'><binaryConfiguration /></igniteConfiguration>"); + CheckSchemaValidation(@"<igniteConfiguration xmlns='http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection' igniteInstanceName='myGrid'><binaryConfiguration /></igniteConfiguration>"); // Invalid schema Assert.Throws<XmlSchemaValidationException>(() => CheckSchemaValidation( http://git-wip-us.apache.org/repos/asf/ignite/blob/7a18c3c5/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs index 4e29a91..e4e3451 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs @@ -88,7 +88,10 @@ namespace Apache.Ignite.Core.Binary var arg = new KeyValuePair<int, int>(GetDataStart(binObj), GetDataLength(binObj)); - return new BinaryHeapStream(binObj.Data).Apply(this, arg); + using (var stream = new BinaryHeapStream(binObj.Data)) + { + return stream.Apply(this, arg); + } } /** <inheritdoc /> */ http://git-wip-us.apache.org/repos/asf/ignite/blob/7a18c3c5/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs index 8aa446a..1be9018 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs @@ -56,8 +56,11 @@ namespace Apache.Ignite.Core.Events /// Initializes a new instance of the <see cref="EventBase"/> class. /// </summary> /// <param name="r">The reader to read data from.</param> + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] protected EventBase(IBinaryRawReader r) { + Debug.Assert(r != null); + _id = r.ReadObject<IgniteGuid>(); _localOrder = r.ReadLong(); http://git-wip-us.apache.org/repos/asf/ignite/blob/7a18c3c5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs index ad35ff9..a14da0a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs @@ -420,8 +420,11 @@ namespace Apache.Ignite.Core.Impl.Binary.IO } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] public override T Apply<TArg, T>(IBinaryStreamProcessor<TArg, T> proc, TArg arg) { + Debug.Assert(proc != null); + fixed (byte* data0 = _data) { return proc.Invoke(data0, arg); http://git-wip-us.apache.org/repos/asf/ignite/blob/7a18c3c5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs index 3719846..190bda9 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs @@ -18,6 +18,7 @@ namespace Apache.Ignite.Core.Impl.Memory { using System; + using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Text; @@ -734,8 +735,11 @@ namespace Apache.Ignite.Core.Impl.Memory /// <summary> /// Returns a hash code for the specified byte range. /// </summary> + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] public T Apply<TArg, T>(IBinaryStreamProcessor<TArg, T> proc, TArg arg) { + Debug.Assert(proc != null); + return proc.Invoke(_data, arg); } http://git-wip-us.apache.org/repos/asf/ignite/blob/7a18c3c5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/CacheTransactionManager.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/CacheTransactionManager.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/CacheTransactionManager.cs index bc76ca1..a2ef63c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/CacheTransactionManager.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/CacheTransactionManager.cs @@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Impl.Transactions { using System; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Transactions; using Apache.Ignite.Core.Transactions; @@ -82,8 +83,11 @@ namespace Apache.Ignite.Core.Impl.Transactions } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] void IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment) { + Debug.Assert(preparingEnlistment != null); + var igniteTx = _transactions.Tx; if (igniteTx != null && Enlistment.Value != null) @@ -95,8 +99,11 @@ namespace Apache.Ignite.Core.Impl.Transactions } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] void IEnlistmentNotification.Commit(Enlistment enlistment) { + Debug.Assert(enlistment != null); + var igniteTx = _transactions.Tx; if (igniteTx != null && Enlistment.Value != null) @@ -114,8 +121,11 @@ namespace Apache.Ignite.Core.Impl.Transactions } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] void IEnlistmentNotification.Rollback(Enlistment enlistment) { + Debug.Assert(enlistment != null); + var igniteTx = _transactions.Tx; if (igniteTx != null && Enlistment.Value != null) @@ -131,8 +141,11 @@ namespace Apache.Ignite.Core.Impl.Transactions } /** <inheritdoc /> */ + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")] void IEnlistmentNotification.InDoubt(Enlistment enlistment) { + Debug.Assert(enlistment != null); + enlistment.Done(); }
