VelocityDB & VelocityGraph

Object and Graph Database - ask us, share & let us know what you need.

Issues with AllObjects<T> and UpdateTypeVersion

1) If I just call session.AllObjects<T> , I get an exception

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0
   System.Reflection.RuntimeModule.GetTypes() +9
   System.Reflection.Assembly.GetTypes() +143
   VelocityDb.OfType.a(Assembly A_0) +14
   System.Linq.<SelectManyIterator>d__31`3.MoveNext() +267
   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +165
   VelocityDb.OfType.a(SessionBase A_0) +904
   VelocityDb.b.v() +1050
   VelocityDb.a.g() +221

But when I use session.AllObjects<T>(false), there is no such exception. I don't know is it a bug or not.


2) I need to update class with already persisted objects before after adding another indexable value (i.e.[Index]private string _anotherIndex ), but I cannot.

There is an exception (I've tried session.UpdateClass in different places)

Line 23:                 session.UpdateClass(typeof(DomainObject));
Line 24: foreach(var o in session.AllObjects<DomainObject>(false)) Line 25: o.UpdateTypeVersion(); Line 26: Line 27: session.Commit();


Source File: --

Stack Trace: 

[ArgumentOutOfRangeException: Index and count must refer to a location within the buffer.
Parameter name: bytes]
   System.Text.UTF8Encoding.GetString(Byte[] bytes, Int32 index, Int32 count) +14309108
   VelocityDb.TypeInfo.DataMember.DecodeToString(Byte[] member, Int32& offset, Int32 numberOfBytes) +79
   VelocityDb.TypeInfo.DataMember.a(Byte[] A_0, Int32& A_1, Object A_2, IOptimizedPersistable A_3, SessionBase A_4, Page A_5, Boolean A_6, Schema A_7, Boolean A_8, List`1 A_9, Int32 A_10, Int32 A_11, Boolean A_12) +804
   VelocityDb.OptimizedPersistable.ReadMeUsingSchemaReflection(TypeVersion typeVersion, Byte[] memberBytes, Int32& offset, IOptimizedPersistable pObj, SessionBase session, Page page, Boolean useOidShort, Schema schema, Boolean openRefs, List`1 toLoadMembers, Int32 graphDepth, Int32 graphDepthToLoad, Boolean primitivesOnly) +481
   VelocityDb.TypeInfo.TypeVersion.LoadMembers(IOptimizedPersistable toLoad, Schema schema, List`1 toLoadMembers, Int32 graphDepth, Int32 graphDepthToLoad, SessionBase session, Boolean primitivesOnly) +372
   VelocityDb.TypeInfo.Schema.a(Byte[] A_0, Boolean A_1, SessionBase A_2, UInt64 A_3, Page A_4, Boolean A_5, List`1 A_6, Int32 A_7, Int32 A_8, TypeVersion A_9) +787
   VelocityDb.Page.Slot(UInt64 oid, Boolean openRefs, SessionBase session, Schema schema, Boolean iteration, List`1 toLoadMembers, Int32 graphDepth, Int32 graphDepthToLoad, TypeVersion shape) +801
   VelocityDb.Session.SessionBase.Open(UInt64 oid, Boolean update, List`1 toLoadMembers, Boolean inFlush, Int32 graphDepth, Int32 graphDepthToLoad, Boolean signalNotExistError) +648
   VelocityDb.Collection.BTree.BTreeSet`1.GetKey(Int32 index) +161
   VelocityDb.Collection.BTree.BTreeBase`2.binarySearch(Key aKey, Byte[] comparisonArrayIn, Boolean& isEqual) +668
   VelocityDb.Collection.BTree.BTreeBase`2.RemoveFromLeafRoot(Key key, Byte[] comparisonArray) +27
   VelocityDb.Collection.BTree.BTreeBase`2.Remove(Key key, Byte[] comparisonArray) +66
   VelocityDb.Session.SessionBase.deleteFromIndexes(IOptimizedPersistable pObjBeforeUpdates, TypeVersion typeVersion, TypeVersion objTypeVersion) +1134
   VelocityDb.Session.SessionBase.a(IOptimizedPersistable A_0) +155
   VelocityDb.Session.SessionBase.UpdateObject(IOptimizedPersistable obj, Boolean inFlush, Boolean deleteObjFromIndexes) +314
   VelocityDb.OptimizedPersistable.UpdateTypeVersion() +227

What do I do wrong?