Looks like db4o is trying to create metadata on a read only db (ReadOnlyBin).
Are you opening the db in readonly mode?
I could reproduce your issue with the following code (you don't even need to have different versions of the framework):
- Run the application with ProxyTuple = System.Tuple (to create the database)
- Run it again with ProxyTyple = Db4objects.Db4o.Foundation.Tuple
The problem in this case is that I'm creating the db with System.Tuple (available on .Net 4.0) and trying to open the db on .Net 3.5 using Db4o tuple implementation (since Tuple type does not exist on .Net 3.5).
You may be running into a similar situation.
using System;
using System.IO;
using Db4objects.Db4o;
using Db4objects.Db4o.Config;
using ProxyTuple = Db4objects.Db4o.Foundation.Tuple<int, string>;
//using ProxyTuple = System.Tuple<int, string>;
namespace db4oVersionTest
{
class Program
{
static void Main(string[] args)
{
var databaseFileName = "test.odb";
if (!typeof(ProxyTuple).FullName.Contains("Db4o"))
{
File.Delete(databaseFileName);
using (var db = Db4oEmbedded.OpenFile(databaseFileName))
{
db.Store(new Item { value = 42, tuple = new ProxyTuple(42, "forty two")});
}
}
else
{
using (var db = Db4oEmbedded.OpenFile(NewConfiguration(), databaseFileName))
{
foreach (var item in db.Query<Item>())
{
Console.WriteLine(item);
}
}
}
}
private static IEmbeddedConfiguration NewConfiguration()
{
var configuration = Db4oEmbedded.NewConfiguration();
configuration.File.ReadOnly = true;
return configuration;
}
}
class Item
{
public int value;
public ProxyTuple tuple;
public override string ToString()
{
return value + " " + tuple;
}
}
}