Realm Xamarin v10.16.0 Release Notes

Release Date: 2022-10-03 // over 1 year ago
  • โœจ Enhancements

    • ๐ŸŽ Introduced AsymmetricObject intended for write-heavy workloads, where high performance is generally important. This new object:
      1. syncs data unidirectionaly, from the clients to the server
      2. can't be queried, deleted, or modified once added to the Realm
      3. is only usable with flexible sync
      4. can't be the receiveing end of any type of relationship
      5. can contain EmbeddedObjects but cannot link to RealmObject or AsymmetricObject.

    In the same write transaction, it is legal to add AsymmetricObjects and RealmObjects

      class Measurement : AsymmetricObject
      {
          [PrimaryKey, MapTo("_id")]
          public Guid Id { get; private set; } = Guid.NewGuid();
    
          public double Value { get; set; }
    
          public DataTimeOffset Timestamp { get; private set; } = DateTimeOffset.UtcNow;
      }
    
      class Person : RealmObject
      {
          //............
      }
    
      //.....
    
      var measurement = new Measurement
      {
        Value = 9.876
      };
    
      realm.Write(() =>
      {
          realm.Add(measurement);
    
          realm.Add(new Person());
      });
    
      _ = asymmetricObject.Value;   // runtime error
      _ = realm.All<Measurement>(); // compile time error
    
    • โž• Added two client reset handlers, RecoverUnsyncedChangesHandler and RecoverOrDiscardUnsyncedChangesHandler, that try to automatically merge the unsynced local changes with the remote ones in the event of a client reset. Specifically with RecoverOrDiscardUnsyncedChangesHandler, you can fallback to the discard local strategy in case the automatic merge can't be performed as per your server's rules. These new two stragegies simplify even more the handling of client reset events when compared to DiscardUnsyncedChangesHandler.RecoverOrDiscardUnsyncedChangesHandler is going to be the default from now on. An example is as follows
    • โž• Added two client reset handlers, RecoverUnsyncedChangesHandler and RecoverOrDiscardUnsyncedChangesHandler, that try to automatically merge the unsynced local changes with the remote ones in the event of a client reset. Specifically with RecoverOrDiscardUnsyncedChangesHandler, you can fallback to the discard unsynced strategy in case the automatic merge can't be performed as per your server's rules. These new two stragegies simplify even more the handling of client reset events when compared to DiscardUnsyncedChangesHandler.RecoverOrDiscardUnsyncedChangesHandler is going to be the default from now on. More info on the aforementioned strategies can be found in our docs page. An example usage of one of the new handler is as follows:

      var conf = new PartitionSyncConfiguration(partition, user)
      {
      ClientResetHandler = new RecoverOrDiscardUnsyncedChangesHandler
      {
        // As always, the following callbacks are optional
      
        OnBeforeReset = (beforeFrozen) =>
        {
          // executed right before a client reset is about to happen
        },
        OnAfterRecovery = (beforeFrozen, after) =>
        {
          // executed right after an automatic recovery from a client reset has completed
        },
        OnAfterDiscard = (beforeFrozen, after) =>
        {
          // executed after an automatic recovery from a client reset has failed but the DiscardUnsyncedChanges fallback has completed
        },
        ManualResetFallback = (session, err) =>
        {
          // handle the reset manually
        }
      }
      };
      

      (PR #2745)

    • โฌ†๏ธ Introducing string query support for constant list expressions such as realm.All<Car>().Filter("Color IN {'blue', 'orange'}"). This also includes general query support for list vs list matching such as realm.All<Car>().Filter("NONE Features IN {'ABS', 'Seat Heating'}"). (Core upgrade)

    • ๐Ÿ‘Œ Improve performance when a new Realm file connects to the server for the first time, especially when significant amounts of data has been written while offline. (Core upgrade)

    • โฌ†๏ธ Shift more of the work done on the sync worker thread out of the write transaction used to apply server changes, reducing how long it blocks other threads from writing. (Core upgrade)

    • ๐Ÿ‘Œ Improve the performance of the sync changeset parser, which speeds up applying changesets from the server. (Core upgrade)

    ๐Ÿ›  Fixed

    • โž• Added a more meaningful error message whenever a project doesn't have [TargetFramework] defined. (Issue #2843)
    • Opening a read-only Realm for the first time with a SyncConfiguration did not set the schema version, which could lead to m_schema_version != ObjectStore::NotVersioned assertion failures. (Core upgrade)
    • โฌ†๏ธ Upload completion callbacks (i.e. Session.WaitForUploadAsync) may have called before the download message that completed them was fully integrated. (Core upgrade)
    • ๐Ÿ›  Fixed an exception "fcntl() with F_BARRIERFSYNC failed: Inappropriate ioctl for device" when running with MacOS on an exFAT drive. (Core upgrade)
    • โฌ†๏ธ Syncing of a Decimal128 with big significand could result in a crash. (Core upgrade)
    • โฌ†๏ธ Realm.Refresh() did not actually advance to the latest version in some cases. If there was a version newer than the current version which did not require blocking it would advance to that instead, contrary to the documented behavior. (Core upgrade)
    • โฌ†๏ธ Several issues around notifications were fixed. (Core upgrade)
      • Fix a data race on RealmCoordinator::m_sync_session which could occur if multiple threads performed the initial open of a Realm at once.
      • If a SyncSession outlived the parent Realm and then was adopted by a new Realm for the same file, other processes would not get notified for sync writes on that file.
      • Fix one cause of QoS inversion warnings when performing writes on the main thread on Apple platforms. Waiting for async notifications to be ready is now done in a QoS-aware ways.
    • ๐Ÿ”€ If you set a subscription on a link in flexible sync, the server would not know how to handle it (#5409, since v11.6.1)
    • โฌ†๏ธ If a case insensitive query searched for a string including an 4-byte UTF8 character, the program would crash. (Core upgrade)
    • โž• Added validation to prevent adding a removed object using Realm.Add. (Issue #3020)

    Compatibility

    • Realm Studio: 12.0.0 or later.

    Internal

    • Using Core 12.7.0.