CB Lite DB016 AccessViolationException on UWP when DB encryption is on

I’m using CB Lite developer build #16 on Windows UWP
One of my integration tests fails with an AccessViolationException, but only when I use DB encyption with DatabaseConfiguration.EncryptionKey.

The error occurs when saving a simple document with Database.Save. I can reproduce the error with one specific test case, but all of my other test cases do not fail, even though they also save documents. I have not been able to replicate this with a simple test program.

Here’s the trace:

System.AccessViolationException occurred
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
	Source=Couchbase.Lite
  StackTrace:
   at LiteCore.Interop.Native.c4db_endTransaction(C4Database* database, Boolean commit, C4Error* outError)
   at Couchbase.Lite.Database.<>c__DisplayClass70_0.<EndTransaction>b__0(C4Error* err)
   at LiteCore.Interop.NativeHandler.Execute(C4TryLogicDelegate1 block)
   at Couchbase.Lite.Database.EndTransaction(Boolean commit)
   at Couchbase.Lite.Document.Save(IConflictResolver resolver, Boolean deletion)
   at Couchbase.Lite.Document.<Save>b__22_0()
   at Couchbase.Lite.Support.ThreadSafety.DoLocked(Action a)
   at Couchbase.Lite.Document.Save()
   at Couchbase.Lite.Database.<>c__DisplayClass67_0.<Save>b__0()
   at Couchbase.Lite.Support.ThreadSafety.DoLocked(Action a)
   at Couchbase.Lite.Database.Save(Document document)
   at XXXXXXXXX.XXXX.Business.Database.XXXXDatabaseCommon.Create(DocumentId docIdToCreate, IDictionary`2 docProperties)
   at XXXXXXXXX.XXXX.Business.Database.XXXXDatabaseCommon.<BuildAuthenticator>d__61.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at XXXXXXXXX.XXXX.Business.Database.XXXXDatabaseCommon.BuildAuthenticator(ReplicationConfig config, SyncDirection direction)
   at XXXXXXXXX.XXXX.Business.Database.XXXXDatabaseCommon.<StartReplication>d__59.MoveNext()
   at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at XXXXXXXXX.XXXX.Business.Database.XXXXDatabaseCommon.StartReplication(ReplicationConfig config, SyncDirection direction)
   at XXXXXXXXX.XXXX.Tests.Business.Database.ReplicationTestCases.<ReplicationTokenAuth>d__8.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at XXXXXXXXX.XXXX.Tests.Business.Database.ReplicationTestCases.ReplicationTokenAuth()}	System.AccessViolationException

Update:
it requires at least 2 of my test cases to run in the correct order, no single test case will reproduce this in my test suite

Without a repro case, this kind of error is a wild goose chase. It basically means a piece of memory was access after it was released in the native library. If you can consistently reproduce it then file an issue on the repo.