We never used the entitymanager syncing capabilities in Cocktail. We recently started getting this error on some of our saves:
Exception has been thrown by the target of an invocation.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at DomainServices.Models.BaseEntitiesRepository`1.<Save>d__8.MoveNext()
An EntityManager can only execute on a single thread. This EntityManager is authorized to execute on the thread with id=’8’; the requested operation came from the thread with Id=‘1’.
You may have to disable this cross-thread checking for specific reasons such as automated testing. Please review our documentation on multi-threading issues and the EntityManager.AuthorizedThreadId property.
at IdeaBlade.EntityModel.EntityManager.SafeThreadingCheck()
at IdeaBlade.EntityModel.EntityManager.ImportEntities(IEnumerable entities, MergeStrategy mergeStrategy)
at Cocktail.EntityManagerProvider`1.Caliburn.Micro.IHandle<Cocktail.SyncDataMessage<T>>.Handle(SyncDataMessage`1 syncData)
It appears that this is being thrown by an entity manager that is trying to sync up its changes. We are calling save changes from an event so that is why the two managers would be on different threads. However we never added a sync interceptor and according to the documentation there is not syncing by default. I am still getting the problem even if I have an interceptor that returns false for importing and exporting. What am I doing wrong?