I have a server running .net 4.0 which is creating a db4o database and sending it to a client. The client is running .net 3.5, and cannot open the database (This used to work when the server was also 3.5).
The client throws a Db4oIOException
with a stack trace that looks like this:
at Db4objects.Db4o.IO.ReadOnlyBin.Write(Int64 position, Byte[] bytes, Int32 bytesToWrite)
at Db4objects.Db4o.IO.BinDecorator.Write(Int64 position, Byte[] bytes, Int32 bytesToWrite)
at Db4objects.Db4o.IO.BlockAwareBin.BlockWrite(Int32 address, Int32 offset, Byte[] bytes, Int32 length)
at Db4objects.Db4o.Internal.IoAdaptedObjectContainer.WriteBytes(ByteArrayBuffer buffer, Int32 blockedAddress, Int32 addressOffset)
at Db4objects.Db4o.Internal.LocalObjectContainer.WritePointer(Int32 id, Slot slot)
at Db4objects.Db4o.Internal.LocalObjectContainer.AllocatePointerSlot()
at Db4objects.Db4o.Internal.Ids.PointerBasedIdSystem.NewId()
at Db4objects.Db4o.Internal.Ids.TransactionalIdSystemImpl.AcquireId()
at Db4objects.Db4o.Internal.Ids.TransactionalIdSystemImpl.NewId(SlotChangeFactory slotChangeFactory)
at Db4objects.Db4o.Internal.PersistentBase.Write(Transaction trans)
...
Any ideas on how to either save the database in a compatible format, or load without errors?
Additional information
I don't seem to be storing any .net 4.0 specific data. Opening the database in LINQPad and just browsing it shows only my own custom classes (which were all built under 3.5).
It seems that the object / type that db4o is trying to write is System.Reflection.Cache.InternalCache
. There is an issue on db4o's Jira that might be related (or might not).
There is also a bug filed with an eerily similar stack trace.
Using Db4oEmbedded.OpenFile(Db4oConfiguration.Default(), path)
causes this exception. If I use Db4oEmbedded.OpenFile(path)
instead, then an exception is not thrown, but some objects are missing from the restored data.