You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2016/09/13 15:42:39 UTC

ignite git commit: Fix data exchange

Repository: ignite
Updated Branches:
  refs/heads/ignite-3199-1 491057ac3 -> 9213a5c8f


Fix data exchange


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9213a5c8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9213a5c8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9213a5c8

Branch: refs/heads/ignite-3199-1
Commit: 9213a5c8f5ee77c8d954fb508edc2a96b48b13ea
Parents: 491057a
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Sep 13 18:42:27 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Sep 13 18:42:27 2016 +0300

----------------------------------------------------------------------
 .../platform/cache/PlatformCache.java           |  2 +-
 .../PlatformDotnetSessionCacheExtension.java    | 27 +++++++---
 .../websession/PlatformDotnetSessionData.java   | 52 +++++++++++++-------
 .../PlatformDotnetSessionLockResult.java        | 27 ++++++++--
 .../Impl/KeyValueDirtyTrackedCollection.cs      | 27 ++++++----
 .../Impl/SessionStateLockResult.cs              |  5 +-
 .../BinarizableSessionStateStoreDataTest.cs     | 24 ++++++++-
 .../KeyValueDirtyTrackedCollectionTest.cs       | 44 ++++++++++++-----
 .../Apache.Ignite.Core.Tests/TestUtils.cs       | 11 -----
 9 files changed, 155 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9213a5c8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 5c4bf23..a1f8da9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -525,7 +525,7 @@ public class PlatformCache extends PlatformAbstractTarget {
     /**
      * Writes the result to reused stream, if any.
      */
-    private long writeResult(PlatformMemory mem, Object obj, PlatformWriterClosure clo) {
+    public long writeResult(PlatformMemory mem, Object obj, PlatformWriterClosure clo) {
         if (obj == null)
             return FALSE;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9213a5c8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionCacheExtension.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionCacheExtension.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionCacheExtension.java
index 9ee72ec..b5a0dfa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionCacheExtension.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionCacheExtension.java
@@ -18,11 +18,12 @@
 package org.apache.ignite.internal.processors.platform.websession;
 
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.binary.BinaryReader;
 import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.binary.BinaryRawWriterEx;
 import org.apache.ignite.internal.processors.platform.cache.PlatformCache;
 import org.apache.ignite.internal.processors.platform.cache.PlatformCacheExtension;
 import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
+import org.apache.ignite.internal.processors.platform.utils.PlatformWriterClosure;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 import java.sql.Timestamp;
@@ -66,10 +67,14 @@ public class PlatformDotnetSessionCacheExtension implements PlatformCacheExtensi
                 long lockId = reader.readLong();
                 Timestamp lockTime = reader.readTimestamp();
 
-                Object res = target.rawCache().invoke(key,
-                    new PlatformDotnetSessionLockProcessor(lockNodeId, lockId, lockTime));
+                final PlatformDotnetSessionLockResult res = (PlatformDotnetSessionLockResult)
+                    target.rawCache().invoke(key, new PlatformDotnetSessionLockProcessor(lockNodeId, lockId, lockTime));
 
-                return target.writeResult(mem, res);
+                return target.writeResult(mem, res, new PlatformWriterClosure() {
+                    @Override public void write(BinaryRawWriterEx writer, Object val) {
+                        res.writeBinary(writer);
+                    }
+                });
             }
 
             case OP_SET_AND_UNLOCK: {
@@ -78,7 +83,9 @@ public class PlatformDotnetSessionCacheExtension implements PlatformCacheExtensi
                 PlatformDotnetSessionSetAndUnlockProcessor proc;
 
                 if (reader.readBoolean()) {
-                    PlatformDotnetSessionData data = reader.readObject();
+                    PlatformDotnetSessionData data = new PlatformDotnetSessionData();
+
+                    data.readBinary(reader);
 
                     proc = new PlatformDotnetSessionSetAndUnlockProcessor(data);
                 }
@@ -97,9 +104,13 @@ public class PlatformDotnetSessionCacheExtension implements PlatformCacheExtensi
             case OP_GET: {
                 String key = reader.readString();
 
-                PlatformDotnetSessionData data = (PlatformDotnetSessionData)target.rawCache().get(key);
+                final PlatformDotnetSessionData data = (PlatformDotnetSessionData)target.rawCache().get(key);
 
-                return target.writeResult(mem, data);
+                return target.writeResult(mem, data, new PlatformWriterClosure() {
+                    @Override public void write(BinaryRawWriterEx writer, Object val) {
+                        data.writeBinary(writer);
+                    }
+                });
             }
 
             case OP_PUT: {
@@ -107,7 +118,7 @@ public class PlatformDotnetSessionCacheExtension implements PlatformCacheExtensi
 
                 PlatformDotnetSessionData data = new PlatformDotnetSessionData();
 
-                data.readBinary((BinaryReader)reader);
+                data.readBinary(reader);
 
                 target.rawCache().put(key, data);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9213a5c8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java
index 3f5c34a..2a3a52e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java
@@ -212,39 +212,57 @@ public class PlatformDotnetSessionData implements Binarylizable {
     @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
         BinaryRawWriter raw = writer.rawWriter();
 
-        raw.writeInt(timeout);
-        raw.writeUuid(lockNodeId);
-        raw.writeLong(lockId);
-        raw.writeTimestamp(lockTime);
+        writeBinary(raw);
+    }
+
+    /**
+     * Writes to a binary writer.
+     *
+     * @param writer Binary writer.
+     */
+    public void writeBinary(BinaryRawWriter writer) {
+        writer.writeInt(timeout);
+        writer.writeUuid(lockNodeId);
+        writer.writeLong(lockId);
+        writer.writeTimestamp(lockTime);
 
-        raw.writeBoolean(isDiff);
-        raw.writeInt(items.size());
+        writer.writeBoolean(isDiff);
+        writer.writeInt(items.size());
 
         for (Map.Entry<String, byte[]> e : items.entrySet()) {
-            raw.writeString(e.getKey());
-            raw.writeByteArray(e.getValue());
+            writer.writeString(e.getKey());
+            writer.writeByteArray(e.getValue());
         }
 
-        raw.writeByteArray(staticObjects);
+        writer.writeByteArray(staticObjects);
     }
 
     /** {@inheritDoc} */
     @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
         BinaryRawReader raw = reader.rawReader();
 
-        timeout = raw.readInt();
-        lockNodeId = raw.readUuid();
-        lockId = raw.readLong();
-        lockTime = raw.readTimestamp();
+        readBinary(raw);
+    }
+
+    /**
+     * Reads from a binary reader.
+     *
+     * @param reader Reader.
+     */
+    public void readBinary(BinaryRawReader reader) {
+        timeout = reader.readInt();
+        lockNodeId = reader.readUuid();
+        lockId = reader.readLong();
+        lockTime = reader.readTimestamp();
 
         items = new TreeMap<>();
-        isDiff = raw.readBoolean();
-        int count = raw.readInt();
+        isDiff = reader.readBoolean();
+        int count = reader.readInt();
 
         for (int i = 0; i < count; i++)
-            items.put(raw.readString(), raw.readByteArray());
+            items.put(reader.readString(), reader.readByteArray());
 
-        staticObjects = raw.readByteArray();
+        staticObjects = reader.readByteArray();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/9213a5c8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionLockResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionLockResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionLockResult.java
index ae01a4d..7893871 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionLockResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionLockResult.java
@@ -49,6 +49,8 @@ public class PlatformDotnetSessionLockResult implements Binarylizable {
      * @param lockTime Lock time.
      */
     public PlatformDotnetSessionLockResult(boolean success, PlatformDotnetSessionData data, Timestamp lockTime) {
+        assert success ^ (data == null);
+
         this.success = success;
         this.data = data;
         this.lockTime = lockTime;
@@ -79,9 +81,21 @@ public class PlatformDotnetSessionLockResult implements Binarylizable {
     @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
         BinaryRawWriter raw = writer.rawWriter();
 
-        raw.writeBoolean(success);
-        raw.writeObject(data);
-        raw.writeTimestamp(lockTime);
+        writeBinary(raw);
+    }
+
+    /**
+     * Writes to a binary writer.
+     *
+     * @param writer Binary writer.
+     */
+    public void writeBinary(BinaryRawWriter writer) {
+        writer.writeBoolean(success);
+
+        if (success)
+            data.writeBinary(writer);
+
+        writer.writeTimestamp(lockTime);
     }
 
     /** {@inheritDoc} */
@@ -89,7 +103,12 @@ public class PlatformDotnetSessionLockResult implements Binarylizable {
         BinaryRawReader raw = reader.rawReader();
 
         success = raw.readBoolean();
-        data = raw.readObject();
+
+        if (success) {
+            data = new PlatformDotnetSessionData();
+            data.readBinary(raw);
+        }
+
         lockTime = raw.readTimestamp();
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9213a5c8/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/KeyValueDirtyTrackedCollection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/KeyValueDirtyTrackedCollection.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/KeyValueDirtyTrackedCollection.cs
index 8569607..e70cea4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/KeyValueDirtyTrackedCollection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/KeyValueDirtyTrackedCollection.cs
@@ -21,7 +21,9 @@ namespace Apache.Ignite.AspNet.Impl
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Globalization;
+    using System.IO;
     using System.Linq;
+    using System.Runtime.Serialization.Formatters.Binary;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Common;
 
@@ -204,7 +206,7 @@ namespace Apache.Ignite.AspNet.Impl
 
                 var removed = GetRemovedKeys();
 
-                var count = _list.Count + (removed == null ? 0 : removed.Count);
+                var count = _list.Count(x => x.IsDirty) + (removed == null ? 0 : removed.Count);
 
                 writer.WriteInt(count);  // reserve count
 
@@ -215,8 +217,6 @@ namespace Apache.Ignite.AspNet.Impl
                     {
                         writer.WriteString(removedKey);
                         writer.WriteByteArray(null);
-
-                        count++;
                     }
                 }
 
@@ -230,12 +230,13 @@ namespace Apache.Ignite.AspNet.Impl
 
                     // Write as byte array to enable partial deserialization.
                     writer.WriteByteArray(entry.GetBytes());
-
-                    count++;
                 }
             }
         }
 
+        /// <summary>
+        /// Gets the removed keys.
+        /// </summary>
         private ICollection<string> GetRemovedKeys()
         {
             if (_removedKeys == null)
@@ -458,8 +459,11 @@ namespace Apache.Ignite.AspNet.Impl
                 {
                     if (!_isDeserialized)
                     {
-                        // TODO: BinaryFormatter
-                        //_value = _marsh.Unmarshal<object>((byte[]) _value);
+                        using (var stream = new MemoryStream((byte[])_value))
+                        {
+                            _value = new BinaryFormatter().Deserialize(stream);
+                        }
+
                         _isDeserialized = true;
                     }
 
@@ -491,9 +495,12 @@ namespace Apache.Ignite.AspNet.Impl
                 if (!_isDeserialized)
                     return (byte[]) _value;
 
-                // TODO: BinaryFormatter
-                //return marsh.Marshal(_value);
-                return null;
+                using (var stream = new MemoryStream())
+                {
+                    new BinaryFormatter().Serialize(stream, _value);
+
+                    return stream.ToArray();
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9213a5c8/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/SessionStateLockResult.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/SessionStateLockResult.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/SessionStateLockResult.cs
index 69cc723..100fc18 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/SessionStateLockResult.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/SessionStateLockResult.cs
@@ -43,7 +43,10 @@ namespace Apache.Ignite.AspNet.Impl
         public SessionStateLockResult(IBinaryRawReader reader)
         {
             _success = reader.ReadBoolean();
-            _data = reader.ReadObject<SessionStateData>();
+
+            if (_success)
+                _data = new SessionStateData(reader);
+
             _lockTime = reader.ReadTimestamp();
 
             Debug.Assert(_success ^ (_data == null));

http://git-wip-us.apache.org/repos/asf/ignite/blob/9213a5c8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/BinarizableSessionStateStoreDataTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/BinarizableSessionStateStoreDataTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/BinarizableSessionStateStoreDataTest.cs
index 0bb711e..929f0e4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/BinarizableSessionStateStoreDataTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/BinarizableSessionStateStoreDataTest.cs
@@ -18,7 +18,10 @@
 namespace Apache.Ignite.Core.Tests.AspNet
 {
     using System;
+    using System.IO;
     using Apache.Ignite.AspNet.Impl;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.IO;
     using NUnit.Framework;
 
     /// <summary>
@@ -60,7 +63,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
             data.Items["key1"] = 1;
             data.Items["key2"] = 2;
 
-            var data0 = TestUtils.SerializeDeserialize(data);
+            var data0 = SerializeDeserialize(data);
 
             Assert.AreEqual(data.Timeout, data0.Timeout);
             Assert.AreEqual(data.LockId, data0.LockId);
@@ -69,5 +72,24 @@ namespace Apache.Ignite.Core.Tests.AspNet
             Assert.AreEqual(data.StaticObjects, data0.StaticObjects);
             Assert.AreEqual(data.Items.GetKeys(), data0.Items.GetKeys());
         }
+
+        /// <summary>
+        /// Serializes and deserializes back an instance.
+        /// </summary>
+        private static SessionStateData SerializeDeserialize(SessionStateData data)
+        {
+            var marsh = BinaryUtils.Marshaller;
+
+            using (var stream = new BinaryHeapStream(128))
+            {
+                var writer = marsh.StartMarshal(stream);
+
+                data.WriteBinary(writer.GetRawWriter());
+
+                stream.Seek(0, SeekOrigin.Begin);
+
+                return new SessionStateData(marsh.StartUnmarshal(stream));
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9213a5c8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/KeyValueDirtyTrackedCollectionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/KeyValueDirtyTrackedCollectionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/KeyValueDirtyTrackedCollectionTest.cs
index f3a29b2..9c8947b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/KeyValueDirtyTrackedCollectionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/KeyValueDirtyTrackedCollectionTest.cs
@@ -18,8 +18,11 @@
 namespace Apache.Ignite.Core.Tests.AspNet
 {
     using System;
+    using System.IO;
     using System.Linq;
     using Apache.Ignite.AspNet.Impl;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.IO;
     using NUnit.Framework;
 
     /// <summary>
@@ -34,7 +37,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
         public void TestEmpty()
         {
             var col1 = new KeyValueDirtyTrackedCollection();
-            var col2 = TestUtils.SerializeDeserialize(col1);
+            var col2 = SerializeDeserialize(col1);
 
             foreach (var col in new[] {col1, col2})
             {
@@ -91,7 +94,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
             Assert.AreEqual(3, col["1"]);
 
             // Serialize.
-            var col0 = TestUtils.SerializeDeserialize(col);
+            var col0 = SerializeDeserialize(col);
 
             Assert.AreEqual(col.GetKeys(), col0.GetKeys());
             Assert.AreEqual(col.GetKeys().Select(x => col[x]), col0.GetKeys().Select(x => col0[x]));
@@ -147,7 +150,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
 
             var col = getCol();
 
-            var col0 = TestUtils.SerializeDeserialize(col);
+            var col0 = SerializeDeserialize(col);
 
             Assert.AreEqual(3, col0.Count);
 
@@ -166,7 +169,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
 
             // Apply serialized changes without WriteChangesOnly.
             col = getCol();
-            col.ApplyChanges(TestUtils.SerializeDeserialize(col0));
+            col.ApplyChanges(SerializeDeserialize(col0));
 
             Assert.AreEqual(3, col.Count);
             Assert.AreEqual(null, col["1"]);
@@ -178,7 +181,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
             col0.WriteChangesOnly = true;
 
             col = getCol();
-            col.ApplyChanges(TestUtils.SerializeDeserialize(col0));
+            col.ApplyChanges(SerializeDeserialize(col0));
 
             Assert.AreEqual(3, col.Count);
             Assert.AreEqual(null, col["1"]);
@@ -192,19 +195,19 @@ namespace Apache.Ignite.Core.Tests.AspNet
             col0["2"] = 222;
 
             col = getCol();
-            col.ApplyChanges(TestUtils.SerializeDeserialize(col0));
+            col.ApplyChanges(SerializeDeserialize(col0));
 
             Assert.AreEqual(2, col.Count);
             Assert.AreEqual(222, col["2"]);
             Assert.AreEqual(44, col["4"]);
 
             // Remove all.
-            col0 = TestUtils.SerializeDeserialize(getCol());
+            col0 = SerializeDeserialize(getCol());
             col0.WriteChangesOnly = true;
             col0.Clear();
 
             col = getCol();
-            col.ApplyChanges(TestUtils.SerializeDeserialize(col0));
+            col.ApplyChanges(SerializeDeserialize(col0));
 
             Assert.AreEqual(0, col.Count);
 
@@ -213,14 +216,14 @@ namespace Apache.Ignite.Core.Tests.AspNet
             col0["-2"] = -2;
 
             col = getCol();
-            col.ApplyChanges(TestUtils.SerializeDeserialize(col0));
+            col.ApplyChanges(SerializeDeserialize(col0));
 
             Assert.AreEqual(2, col.Count);
             Assert.AreEqual(-1, col0["-1"]);
             Assert.AreEqual(-2, col0["-2"]);
 
             // Remove initial key, then add it back, then remove again.
-            col0 = TestUtils.SerializeDeserialize(getCol());
+            col0 = SerializeDeserialize(getCol());
             col0.WriteChangesOnly = true;
 
             col0.Remove("1");
@@ -229,10 +232,29 @@ namespace Apache.Ignite.Core.Tests.AspNet
             col0.Remove("1");
 
             col = getCol();
-            col.ApplyChanges(TestUtils.SerializeDeserialize(col0));
+            col.ApplyChanges(SerializeDeserialize(col0));
 
             Assert.AreEqual(1, col.Count);
             Assert.AreEqual(3, col["3"]);
         }
+
+        /// <summary>
+        /// Serializes and deserializes back an instance.
+        /// </summary>
+        private static KeyValueDirtyTrackedCollection SerializeDeserialize(KeyValueDirtyTrackedCollection data)
+        {
+            var marsh = BinaryUtils.Marshaller;
+
+            using (var stream = new BinaryHeapStream(128))
+            {
+                var writer = marsh.StartMarshal(stream);
+
+                data.WriteBinary(writer.GetRawWriter());
+
+                stream.Seek(0, SeekOrigin.Begin);
+
+                return new KeyValueDirtyTrackedCollection(marsh.StartUnmarshal(stream));
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9213a5c8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
index 3239329..bb6aac6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -368,16 +368,5 @@ namespace Apache.Ignite.Core.Tests
             Assert.IsTrue(proc.WaitForExit(15000));
             Assert.AreEqual(0, proc.ExitCode);
         }
-
-        /// <summary>
-        /// Serializes and deserializes back an instance.
-        /// </summary>
-        public static T SerializeDeserialize<T>(T obj)
-        {
-            var marsh = BinaryUtils.Marshaller;
-
-            return marsh.Unmarshal<T>(marsh.Marshal(obj));
-        }
-
     }
 }