You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Randomly, while settings Schema property of RealmConfiguration using new Type[] { } array value throws an InvalidOperationException with the message:
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
NOTE: I create a realm instance everytime I need to read or write a value in my app. My application is multi-threaded, and notify the UI of the changes over the entities is not a requirement. The read and the writes must be auto-contained.
There is a working thread that constantly read bluetooth objects and read the DB every 500 ms to identify them.
Repro steps
Launch the app, create a RealmConfiguration instance and apply a schema using the Schema property.
Version
10.6.0 dotnet
What SDK flavour are you using?
Local Database only
What type of application is this?
Xamarin
Client OS and version
Android 7, Xamarin.Android 11.4.0.5
Code snippets
Realm instance initialization method:
realmConfiguration = new RealmConfiguration(DefaultRealmFilename);
realmConfiguration.SchemaVersion = CurrentSchemaVersion;
realmConfiguration.MigrationCallback = this.MigrationCallback;
// realmConfiguration.ObjectClasses = new Type[] { } seems deprecated.
// use Schema instead.
try
{
realmConfiguration.Schema = new Type[]
{
typeof(TableA),
typeof(TableB),
};
}
// this code is never reached, the exception throws on the schema part.
try
{
this.realm = Realm.GetInstance(this.realmConfiguration);
#if HEAVY_VERBOSE_MODE
if (SynchronizationContext.Current != null)
{
Logger.Debug("SyncContext is not null.");
}
else
Logger.Debug("SyncContext is null.");
#endif
}
catch(RealmMigrationNeededException realmMigrationException)
{
Logger.Warning("A migration is needed on current app version.");
Logger.Warning(realmMigrationException.ToString());
migrationException = realmMigrationException;
requireMigration = true;
}
For every write or read, the realm object is instantiated using:
at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) [0x00105] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:437 at System.Collections.Generic.Dictionary`2[TKey,TValue].TryGetValue (TKey key, TValue& value) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:888
at Realms.Schema.ObjectSchema.FromType (System.Type type) [0x0000b] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Schema\ObjectSchema.cs:126
at Realms.Schema.RealmSchema+Builder.Add (System.Type type) [0x0000b] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Schema\RealmSchema.cs:341
at Realms.Schema.RealmSchema+Builder..ctor (System.Collections.Generic.IEnumerable`1[T] types) [0x00021] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Schema\RealmSchema.cs:273 at Realms.Realm.GetInstance (Realms.RealmConfigurationBase config) [0x0000a] in D:\a\realm-dotnet\realm-dotnet\11-01 00:50:26.989 V/mono-stdout(30354): at Realms.Schema.RealmSchema.op_Implicit (System.Collections.Generic.HashSet`1[T] objects) [0x00000] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Schema\RealmSchema.cs:245 at Realms.Schema.RealmSchema+<>c.<.cctor>b__25_0 () [0x00090] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Schema\RealmSchema.cs:66 at System.Lazy`1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) [0x0001c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:327 --- End of stack trace from previous location where exception was thrown --- at System.Lazy`1[T].CreateValue () [0x0007e] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:435 at System.Lazy`1[T].get_Value () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:509 at Realms.Schema.RealmSchema.get_Default () [0x00000] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Schema\RealmSchema.cs:99 at Realms.RealmConfigurationBase.GetSchema () [0x0001d] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Configurations\RealmConfigurationBase.cs:241 at Realms.RealmConfiguration.CreateRealm () [0x00000] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Configurations\RealmConfiguration.cs:126 at Realms.Realm.GetInstance (Realms.RealmConfigurationBase config) [0x0000a] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Realm.cs:83
Relevant log output
No response
The text was updated successfully, but these errors were encountered:
Hey, thanks for the report - this definitely looks like a bug and I have very strong feeling I know what's causing it on our end. We'll take a look first thing on Monday and come up with a fix.
What happened?
Randomly, while settings Schema property of RealmConfiguration using new Type[] { } array value throws an InvalidOperationException with the message:
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
NOTE: I create a realm instance everytime I need to read or write a value in my app. My application is multi-threaded, and notify the UI of the changes over the entities is not a requirement. The read and the writes must be auto-contained.
There is a working thread that constantly read bluetooth objects and read the DB every 500 ms to identify them.
Repro steps
Launch the app, create a RealmConfiguration instance and apply a schema using the Schema property.
Version
10.6.0 dotnet
What SDK flavour are you using?
Local Database only
What type of application is this?
Xamarin
Client OS and version
Android 7, Xamarin.Android 11.4.0.5
Code snippets
Realm instance initialization method:
For every write or read, the realm object is instantiated using:
Stacktrace of the exception/crash you're getting
Relevant log output
No response
The text was updated successfully, but these errors were encountered: