I've found a couple of areas where Sterling fails in multithreading when writing to two different tables (each on their own thread). In two was able to fix the code but a third/forth I couldn't find the source of the sync issue. During debug
I'm flatlining the IsoStorage so each case is as if it was the first time trying to create the database.
IsoStorageHelper.EnsureDirectory(string path): I get a file IO error, was able to do a ugly fix by creating a lock object and then only allowing one thread at a time do the _paths.Contains(path) code block. By visual inspection the sync code
looks right but there might be an issue in PathLock.GetLock(string path).
AggregateSerializer.CanSerialize(Type targetType): I get a duplicate Index error, was able to fix by double checking to make sure the _serializerCache list doesn't add the targetType before add. In a multithread enviroment I was getting two threads
trying to check the type int at the same time. Both would pass the first two condition checks and then one would lock and add the int. When the second thread got unlocked, it would then try to add the int as well. By adding the double check
in the lock code it prevents the error.
IsoStorageHelper.GetWriter(string path): I get a file IO error. The error goes away if I force the two threads to sync their writes, but since they are two different tables I don't see the issue. IsolatedStorageDriver.SerializeTypes() and IsolatedStorageDriver.Save(Type
type, int keyIndex, btye btyes) where the two places where it was being called from that was failing. The only thing I can think of is that IsoStorage only allows one file to be writen at a time.
If I need to create a small demo application to demostrate the issues, I will do that on request.