Git Product home page Git Product logo

couchbase-lite-net's Issues

Fix Unit Tests

I'm currently working on ApiTests, but there are lots of other test classes that need love.

Each one needs to be migrated eassentially from JUnit 3 to 4 in order to work with our current version of NUnit (attributes vs. Inheritance). Many of the NUmit methods also swap the ordering of the JUnit method params.

Then, cleanup the Java-like code to fit modern C# style. Verify the logic of the rest, then fix the library where tests fail.

Investigate Xbox support requirements

What is the work needed to expand our current support to include Xbox as well? May be trivial, but want to double-check to see if anything specialized is required.

ApiTest : Async Query Test Results are blocked

How to reproduce :
Run ApiTest.TestAsyncViewQuery() or ApiTest.TestLiveQueryRun()

As Query.RunAsync() called its completion handler via Database.Manager.CapturedContext.Scheduler(), the completion handler gets blocked from processing. This happens because the CapturedContext and the unit test are running on the same thread.

iOS test crash: non-page-aligned, non-allocated pointer being freed

Non-deterministic behavior, but usually happens when running a large number of test sessions without resetting the local sync_gateway.

[0:] CouchbaseLiteiOSTests(32913,0xb0a13000) malloc: *** error for object 0x4c400800: non-page-aligned, non-allocated pointer being freed
*** set a breakpoint in malloc_error_break to debug
mono-rt: Stacktrace:


mono-rt:   at <unknown> <0xffffffff>

mono-rt:   at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_prepare (intptr,intptr,int,intptr&,intptr&) <IL 0x0002a, 0xffffffff>

CouchbaseLiteiOSTests(32913,0xb0a13000) malloc: *** error for object 0xffff: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
mono-rt:   at Mono.Data.Sqlite.SQLite3.Prepare (Mono.Data.Sqlite.SqliteConnection,string,Mono.Data.Sqlite.SqliteStatement,uint,string&) [0x00044] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs:268

mono-rt:   at Mono.Data.Sqlite.SqliteCommand.BuildNextCommand () [0x00019] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteCommand.cs:230

CouchbaseLiteiOSTests(32913,0xb0a13000) malloc: *** error for object 0x1: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
mono-rt:   at Mono.Data.Sqlite.SqliteCommand.GetStatement (int) [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteCommand.cs:264

2014-05-20 20:24:34.271 CouchbaseLiteiOSTests[32913:9707] Batcher: scheduleWithDelay called with delay: 0 ms
mono-rt:   at Mono.Data.Sqlite.SqliteDataReader.NextResult () [0x000cc] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs:914

CouchbaseLiteiOSTests(32913,0xb0a13000) malloc: *** error for object 0x73006469: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
CouchbaseLiteiOSTests(32913,0xb080f000) malloc: *** error for object 0x18f3e224: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
CouchbaseLiteiOSTests(32913,0xb080f000) malloc: *** error for object 0x18f3e220: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
[0:] Batcher: scheduleWithDelay called with delay: 0 ms
mono-rt:   at Mono.Data.Sqlite.SqliteDataReader..ctor (Mono.Data.Sqlite.SqliteCommand,System.Data.CommandBehavior) [0x00051] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs:89

mono-rt:   at Mono.Data.Sqlite.SqliteCommand.ExecuteReader (System.Data.CommandBehavior) [0x00006] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteCommand.cs:539

mono-rt:   at Mono.Data.Sqlite.SqliteCommand.ExecuteNonQuery () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteCommand.cs:568

mono-rt:   at Couchbase.Lite.Storage.MonoSQLiteStorageEngine.InsertWithOnConflict (string,string,Couchbase.Lite.Storage.ContentValues,Couchbase.Lite.Storage.ConflictResolutionStrategy) [0x0004d] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Store/MonoSQLiteStorageEngine.cs:245

mono-rt:   at Couchbase.Lite.Storage.MonoSQLiteStorageEngine.Insert (string,string,Couchbase.Lite.Storage.ContentValues) [0x00006] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Store/MonoSQLiteStorageEngine.cs:230

mono-rt:   at Couchbase.Lite.Database.InsertDocumentID (string) [0x00024] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Database.cs:3740

[0:] mono-rt:   at Couchbase.Lite.Database.GetOrInsertDocNumericID (string) [0x00014] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Database.cs:1211

mono-rt:   at Couchbase.Lite.Database.ForceInsert (Couchbase.Lite.Internal.RevisionInternal,System.Collections.Generic.IList`1<string>,System.Uri) [0x00090] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Database.cs:1088

mono-rt:   at Couchbase.Lite.Replicator.Puller.InsertRevisions (System.Collections.Generic.IList`1<System.Collections.Generic.IList`1<object>>) [0x000b8] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Replication/Puller.cs:459

mono-rt:   at Couchbase.Lite.Support.Batcher`1.ProcessNow () [0x00212] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Replication/Batcher.cs:164

mono-rt:   at Couchbase.Lite.Support.Batcher`1/<Batcher>c__AnonStorey0.<>m__0 () [0x00028] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Replication/Batcher.cs:96

mono-rt:   at Couchbase.Lite.Support.Batcher`1.<ScheduleWithDelay>m__0 (System.Threading.Tasks.Task) [0x00023] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Replication/Batcher.cs:307

mono-rt:   at System.Threading.Tasks.TaskActionInvoker/ActionTaskInvoke.Invoke (System.Threading.Tasks.Task,object,System.Threading.Tasks.Task) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/TaskActionInvoker.cs:113

mono-rt:   at System.Threading.Tasks.Task.InnerInvoke () [0x00019] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/Task.cs:550

mono-rt:   at System.Threading.Tasks.Task.ThreadStart () [0x000d0] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/Task.cs:438

mono-rt:   at System.Threading.Tasks.Task.Execute () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/Task.cs:514

mono-rt:   at System.Threading.Tasks.TpScheduler.TaskExecuterCallback (object) [0x00007] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/TpScheduler.cs:59

mono-rt:   at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00052, 0xffffffff>

mono-rt: 
Native stacktrace:


mono-rt: 
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================



LiveQuery stops working on iOS Sample App

Steps to reproduce :

  1. Create a couple of items
  2. Check and Uncheck one of the items multiple times and fast until UI stops updating the checked status.

Initial Debug :

  1. Even though the UI stops updating, the new revision of the document still gets created.
  2. LiveQuery gets a Database Change event when updating the checked status of the document.
  3. LiveQuery called Update() method to start re-querying the data by dispatching an asyc tasks to a WorkExecutor which is Manager.workExecutor but the async task has never run by the executor. As a result, the UI doesn't get updated with the new result set from the Live Query.

Replace all instances of `lock(this)`

To avoid potential deadlocks, replace lock(this) with a private lock object instead:

private readonly Object locker = new Object();
...
lock(locker)
{
      // Do foo
}

Investigate PS4 support requirements

There are related chores for this, including developer account set up, etc. but a general task to get started is for an investigation into requirements.

Android randomly crashes due to no active transactions

This mostly happens when trying to put new properties to a document several times fast.

StackTrace:
[SQLiteLog] (1) statement aborts at 2: [ROLLBACK] cannot rollback - no transaction is active
[mono-rt] Stacktrace:
[mono-rt] 
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_reset (intptr) <IL 0x00025, 0xffffffff>
[mono-rt]   at Mono.Data.Sqlite.SQLite3.Reset (Mono.Data.Sqlite.SqliteStatement) <IL 0x0000b, 0x0004b>
[mono-rt]   at Mono.Data.Sqlite.SqliteDataReader.NextResult () <IL 0x0002a, 0x0008b>
[mono-rt]   at Mono.Data.Sqlite.SqliteDataReader.Close () <IL 0x0001e, 0x00087>
[mono-rt]   at Couchbase.Lite.Cursor.Close () [0x00018] in /Users/pasin/Git/couchbase-lite-net/src/Couchbase.Lite.Shared/Store/Cursor.cs:127
[mono-rt]   at Couchbase.Lite.Database.GetDocNumericID (string) [0x0006a] in /Users/pasin/Git/couchbase-lite-net/src/Couchbase.Lite.Shared/Database.cs:2190
[mono-rt]   at Couchbase.Lite.Database.PutRevision (Couchbase.Lite.Internal.RevisionInternal,string,bool,Couchbase.Lite.Status) [0x00064] in /Users/pasin/Git/couchbase-lite-net/src/Couchbase.Lite.Shared/Database.cs:2941
[mono-rt]   at Couchbase.Lite.Database.PutRevision (Couchbase.Lite.Internal.RevisionInternal,string,bool) [0x0000c] in /Users/pasin/Git/couchbase-lite-net/src/Couchbase.Lite.Shared/Database.cs:2905
[mono-rt]   at Couchbase.Lite.Document.PutProperties (System.Collections.Generic.IDictionary`2<string, object>,string,bool) [0x0013b] in /Users/pasin/Git/couchbase-lite-net/src/Couchbase.Lite.Shared/Document.cs:432
[mono-rt]   at Couchbase.Lite.Document.PutProperties (System.Collections.Generic.IDictionary`2<string, object>) [0x00016] in /Users/pasin/Git/couchbase-lite-net/src/Couchbase.Lite.Shared/Document.cs:302
[mono-rt]   at SimpleAndroidSync.MainActivity/ListLiveQueryAdapter/<GetView>c__AnonStorey0.<>m__0 (object,System.EventArgs) [0x00055] in /Users/pasin/Git/couchbase-lite-net/samples/SimpleAndroidSync/MainActivity.cs:112
[mono-rt]   at (wrapper delegate-invoke) <Module>.invoke_void__this___object_EventArgs (object,System.EventArgs) <IL 0x00027, 0x00042>
[mono-rt]   at (wrapper delegate-invoke) <Module>.invoke_void__this___object_EventArgs (object,System.EventArgs) <IL 0x00027, 0x00042>
[mono-rt]   at (wrapper delegate-invoke) <Module>.invoke_void__this___object_EventArgs (object,System.EventArgs) <IL 0x00027, 0x00042>
[mono-rt]   at (wrapper delegate-invoke) <Module>.invoke_void__this___object_EventArgs (object,System.EventArgs) <IL 0x00059, 0xffffffff>
[mono-rt]   at Android.Views.View/IOnClickListenerImplementor.OnClick (Android.Views.View) [0x0000d] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/5e0ae404/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.Views.View.cs:1615
[mono-rt]   at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/5e0ae404/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.Views.View.cs:1582
[mono-rt]   at (wrapper dynamic-method) object.8c441b9e-ed72-4adf-a740-3fb1a47b1cb7 (intptr,intptr,intptr) <IL 0x00017, 0x0001f>
[mono-rt]   at (wrapper native-to-managed) object.8c441b9e-ed72-4adf-a740-3fb1a47b1cb7 (intptr,intptr,intptr) <IL 0x00023, 0xffffffff>

[iOS Sample] Invalid update: invalid number of rows in section 0

After deleting checked items via the Clean button, the follow UIAlertView is shown:

The number of rows contained in an existing section after the update (10) must
be equal to the number of rows contained in that section before the update (10),
plus or minus the number of rows inserted or deleted from that section
(0 inserted, 9 deleted) and plus or minus the number of rows moved into or out 
of that section (0 moved in, 0 moved out).

CouchbaseTableSource.DeleteDocumentsAtIndexes throws this because after it calls TableView.DeleteRows the UIKit will call CouchbaseTableSource.RowsInSection during its consistency check.

ReplicationTest.TestGetReplication sometimes fails

When TestGetReplication runs by itself, or with the other tests in ReplicationTest it always passes. However, when running all 87 tests it always fails. When it fails, it fails because it calls replication.Stop() but replication.IsActive returns true.

Support for Windows Store, Phone and others

I would like to discuss the possibility of extending/converting the couchbase lite .net in order to support more platforms than xamarin.droid and xamarin.touch only. Currently the shared files depend on a number of namespaces, such as: System.Data, Mono.Data.Sqlite, System.Web, System.Threading, System.Security... which makes compiling these files with, for example, a windows 8(.1) (store) project impossible.

I think the proper architecture would be to define a PCL with the database functionality rewritten to use something like SQLite.Net-PCL/Async and HttpClient for networking.

Of course, this looks like quite some work, and it has the drawback that automated conversion from java would not be that easy anymore, if not impossible. I can invest some of my time in this, but will not do so if there is no support or interest from others... most notably couchbase.

Evaluate PCL Feasibility

The first consideration will be which profile to target.

Second, will need to consider how to manage the dependency on SQLite. We could move the MonoSqliteStorageEngine to a new Couchbase.Lite.Sqlite non-PCL assembly. However, we'd then need to provide a new default implementation in Couchbase.Lite. If we tried to source link community-sqlite-net, we'd not be able to target WP8 or WinRT (unless they've done a lot of refactoring since last June).

Options:

  1. Default implementation just throws NIE and tells the user to add a real implementation.
  2. Create shims that lets the WP8/WinRT variants of community-sqlite-net run on Xamarin.*.
  3. Create shims that lets the Xamarin variant of community-sqlite-net run on WP8/WinRT.
  4. Create a default implementation that avoids IO and some/all encryption, and or uses reflection to do it.
  5. Not ship a PCL. As nice as PCL's can be, if may end up with a better user experience shipping non-PCLs, especially if not doing so means targeting a weird profile or requiring a bunch of extra steps for library users. The goal is "add package" and it just works.

Perhaps someone with deeper WP8/WinRT-fu can weigh in.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.