Insert fails on Windows 10 IoT (UWP)
HakanL opened this issue · comments
I'm trying to use DBreeze on a Raspberry Pi 3 running Windows 10 IoT. It works fine in the Windows version, but fails when running on the Pi. Here's the exception:
"DBreeze.Exceptions.DBreezeException: Getting table \"@utKeyValue\" from the schema failed! ---> DBreeze.Exceptions.TableNotOperableException: DBreeze.Scheme ---> DBreeze.Exceptions.DBreezeException: Rollback of the table \"DBreeze.Scheme\" failed! ---> DBreeze.Exceptions.DBreezeException: Restore rollback file \"C:\\Data\\Users\\DefaultAccount\\AppData\\Local\\Packages\\068e5313-8012-428f-883e-4e8bc4bb5c4e_mr3ez18jctte6\\LocalCache\\_DBreezeSchema\" failed! ---> System.DllNotFoundException: Unable to load DLL 'kernel32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at DBreeze.Storage.FSR.FlushFileBuffers(IntPtr hFile)
at DBreeze.Storage.FSR.NET_Flush(FileStream mfs)
at DBreeze.Storage.FSR.Rollback()
--- End of inner exception stack trace ---
at DBreeze.LianaTrie.LTrieWriteCache.RollBack()
at DBreeze.LianaTrie.LTrieRootNode.RollBack()
--- End of inner exception stack trace ---
at DBreeze.LianaTrie.LTrieRootNode.RollBack()
at DBreeze.LianaTrie.LTrie.RollBack()
--- End of inner exception stack trace ---
at DBreeze.Scheme.GetTable(String userTableName)
--- End of inner exception stack trace ---
at DBreeze.Transactions.TransactionsCoordinator.GetTable_WRITE(String tableName, Int32 transactionThreadId)
at DBreeze.Transactions.Transaction.GetWriteTableFromBuffer(String tableName)
at DBreeze.Transactions.Transaction.Insert[TKey,TValue](String tableName, TKey key, TValue value, Byte[]& refToInsertedValue, Boolean& WasUpdated, Boolean dontUpdateIfExists)
at DBreeze.Transactions.Transaction.Insert[TKey,TValue](String tableName, TKey key, TValue value)
at App1.App.TestDatabase()
at App1.App.OnLaunched(LaunchActivatedEventArgs e)"
This is the code:
using (var engine = new DBreeze.DBreezeEngine(ApplicationData.Current.LocalCacheFolder.Path))
{
using (var tran = engine.GetTransaction())
{
tran.Insert<string, string>("KeyValue", "Test", DateTime.Now.Ticks.ToString());
tran.Commit();
}
}
The issue is that FlushFileBuffers from kernel32 isn't available on the ARM platform. I changed the define to be NETFX_CORE || NET40 instead so the kernel32 method isn't attempted on the .NET Core compile. I'll submit a PR, please review if that's a correct approach. It worked in my UWP on RPi after this.
You are so right, will fix soon
Please, test latest NuGet package
I'm traveling for a few days and I don't have access to my Pi so unfortunately I can't test until I'm back home :(
It worked great, thank you!
Very well and thanks for the tips!