尝试打开iBoxDb连接时出现ArgumentNullException

时间:2015-01-20 17:41:08

标签: windows-phone-8.1 argumentnullexception nosql

我试图让iBoxDb启动并运行,但是,当我尝试打开连接时,我得到了ArgumentNullException。完全相同的代码在Windows Phone 8.1 Silverlight 上正常工作,但在WP 8.1 运行时上则不行。 我尝试过传递路径参数而不是""ApplicationData.Current.LocalFolder的各种组合),但仍然没有。

由于iBoxDb几乎没有文档,我真的没有想法:|

代码:

    ... 
    private readonly AutoBox _db;

    public iBoxDbRepository()
    {
        var server = new DB(1, "", true);
        _db = server.Open();
    }
    ...

堆栈跟踪:

System.ArgumentNullException occurred _HResult=-2147467261 _message=Value cannot be null. HResult=-2147467261 IsTransient=false Message=Value cannot be null. Parameter name: path1 Source=mscorlib ParamName=path1 StackTrace: at System.IO.Path.Combine(String path1, String path2) at System.IO.IsolatedStorage.IsolatedStorageFile.FetchOrCreateRoot() at System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStore(String group, String id) at System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication() at iBoxDB.LocalServer.IO.BoxIsolatedStorageFileStreamConfig.GetIsolatedStorageFile() at iBoxDB.LocalServer.IO.BoxIsolatedStorageFileStreamConfig.CreateIsolatedStorageFileStream(String path, StreamAccess access) at iBoxDB.LocalServer.IO.BoxIsolatedStorageFileStreamConfig.CreateStream(String path, StreamAccess access) at q..ctor(String A_0, DatabaseConfig A_1, IBoxRecycler A_2) at er.a(DatabaseConfig A_0, String A_1, IBoxRecycler A_2) at ac..ctor(Int64 A_0, String A_1, DatabaseConfig A_2, IBoxRecycler A_3) at iBoxDB.LocalServer.LocalDatabaseServer.a(String A_0, Int64 A_1) at iBoxDB.LocalServer.LocalDatabaseServer.GetInstance(Int64 address) at iBoxDB.LocalServer.DB.Open(Int64 destAddr) at Budget.Data.iBoxDbRepository..ctor() at lambda_method(Closure ) at SimpleInjector.Lifestyles.SingletonLifestyle.SingletonLifestyleRegistrationBase'1.CreateInstanceWithNullCheck() at System.Lazy'1.CreateValue()

1 个答案:

答案 0 :(得分:1)

IsolatedStorageFile.FetchOrCreateRoot()没有参数,什么也做不了。 WP 8.1运行时使用不同的IO API,实现新的DatabaseConfig或更新iBoxDB,然后使用'WSDatabaseConfig'。