Index: /trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs	(revision 1700)
+++ /trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs	(revision 1701)
@@ -7,6 +7,22 @@
 using HeuristicLab.Persistence.Default.Decomposers.Storable;
 using System.Text;
+using System.Runtime.InteropServices;
 
 namespace HeuristicLab.Persistence.Core {
+
+  public class ReferenceEqualityComparer : IEqualityComparer<object> {
+
+    public bool Equals(object a, object b) {
+      return Object.ReferenceEquals(a, b);
+    }
+
+    public int GetHashCode(object obj) {
+      GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Weak);
+      int address = GCHandle.ToIntPtr(handle).ToInt32();
+      handle.Free();
+      return address;
+    }    
+
+  }
 
   public class Serializer : IEnumerable<ISerializationToken> {
@@ -43,5 +59,5 @@
       this.rootName = rootName;
       this.configuration = configuration;
-      obj2id = new Dictionary<object, int> { { new object(), 0 } };
+      obj2id = new Dictionary<object,int>(new ReferenceEqualityComparer()) { { new object(), 0 } };
       typeCache = new Dictionary<Type, int>();
     }
@@ -59,18 +75,19 @@
       if (value == null)
         return NullReferenceEnumerator(accessor.Name);
+      Type type = value.GetType();
       if (obj2id.ContainsKey(value))
         return ReferenceEnumerator(accessor.Name, obj2id[value]);
-      if (!typeCache.ContainsKey(value.GetType()))
-        typeCache.Add(value.GetType(), typeCache.Count);
-      int typeId = typeCache[value.GetType()];
+      if (!typeCache.ContainsKey(type))
+        typeCache.Add(type, typeCache.Count);
+      int typeId = typeCache[type];
       int? id = null;
-      if (!value.GetType().IsValueType) {
+      if ( ! type.IsValueType) {
         id = obj2id.Count;
         obj2id.Add(value, (int)id);
       }
-      IFormatter formatter = configuration.GetFormatter(value.GetType());
+      IFormatter formatter = configuration.GetFormatter(type);
       if (formatter != null)
         return PrimitiveEnumerator(accessor.Name, typeId, formatter.Format(value), id);
-      IDecomposer decomposer = configuration.GetDecomposer(value.GetType());
+      IDecomposer decomposer = configuration.GetDecomposer(type);
       if (decomposer != null)
         return CompositeEnumerator(accessor.Name, decomposer.Decompose(value), id, typeId, decomposer.CreateMetaInfo(value));
Index: /trunk/sources/HeuristicLab.Persistence/UnitTests/UseCases.cs
===================================================================
--- /trunk/sources/HeuristicLab.Persistence/UnitTests/UseCases.cs	(revision 1700)
+++ /trunk/sources/HeuristicLab.Persistence/UnitTests/UseCases.cs	(revision 1701)
@@ -36,4 +36,26 @@
     [Storable]
     private ulong _ulong = 123456;
+  }
+
+  public class IntWrapper {
+
+    [Storable]
+    public int Value;
+
+    private IntWrapper() { }
+
+    public IntWrapper(int value) {
+      this.Value = value;
+    }
+
+    public override bool Equals(object obj) {
+      if (obj as IntWrapper == null)
+        return false;
+      return Value.Equals(((IntWrapper)obj).Value);
+    }
+    public override int GetHashCode() {
+      return Value.GetHashCode();
+    }
+
   }
 
@@ -449,4 +471,18 @@
     }
 
+    [TestMethod]
+    public void TestAliasingWithOverriddenEquals() {
+      List<IntWrapper> ints = new List<IntWrapper>();
+      ints.Add(new IntWrapper(1));
+      ints.Add(new IntWrapper(1));
+      Assert.AreEqual(ints[0], ints[1]);
+      Assert.AreNotSame(ints[0], ints[1]);
+      XmlGenerator.Serialize(ints, tempFile);
+      List<IntWrapper> newInts = (List<IntWrapper>)XmlParser.DeSerialize(tempFile);
+      Assert.AreEqual(newInts[0].Value, 1);
+      Assert.AreEqual(newInts[1].Value, 1);
+      Assert.AreEqual(newInts[0], newInts[1]);
+      Assert.AreNotSame(newInts[0], newInts[1]);
+    }
 
     [ClassInitialize]
