Describe the bug
I am getting exceptions during a push: System.InvalidOperationException: A second operation was started on this context instance before a previous operation completed.
To Reproduce
Similarly to #377 I am not able to produce it with a minimal example, but the bug only occurs when PushOptions are given with ParallelOperations set to more than 1. First I thought that the issue might be related to the fact that in OperationsQueueManager.cs
_ = this._context.Update(operation);
is called inside a lock statement when resolution.Result is ConflictResolutionResult.Server and not when resolution.Result is ConflictResolutionResult.Client. But the exception is also sometimes thrown, when there are no conflicts being resolved, so I now think it might have to do with
object? oldValue = await this._context.FindAsync(entityType, [operation.ItemId], cancellationToken).ConfigureAwait(false);
which could cause concurrent DbContext operations as far as I understand the code? I haven't been able to debug the issue too well and am sticking to using ParallelOperations = 1 for now.
Expected behavior
No exception.
What platforms?
-
Server:
- Version of dotnet being used to compile? 10
- Library versions? 10.0.0
- What database are you using? Microsoft SQL Server
- Where are you running the server? Azure
-
Client:
- What platform (Android, iOS, Windows, etc.) versions are you running on? Android
- Does it happen in an emulator / simulator, or only on a real device? Only tested on real device
- Version of dotnet being used to compile? 10
- .NET Runtime Environment (WPF, UWP, WinUI3, MAUI, etc.): MAUI
- Datsync Toolkit NuGet versions? 10.0.0
Screenshots
Additional context