Uploaded image for project: 'Realm .NET SDK'
  1. Realm .NET SDK
  2. RNET-1128

Crash: Realm.SyncSession is only valid for synchronized Realms

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None

      What happened?

      realm 11.7.0

      Real crashed while reading a table.

      Db = Realm.GetInstance();
      var x = Db.All<DbWallet>().ToList()
      

      Exception:

      System.NotSupportedException: Realm.SyncSession is only valid for synchronized Realms (i.e. ones that are opened with FlexibleSyncConfiguration or PartitionSyncConfiguration). The unsupported member type is located on type 'Realms.Sync.Session'. Path: $.Realm.SyncSession.
       ---> System.NotSupportedException: Realm.SyncSession is only valid for synchronized Realms (i.e. ones that are opened with FlexibleSyncConfiguration or PartitionSyncConfiguration).
         at Realms.Realm.get_SyncSession() in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Realm.cs:line 247
      

      Repro steps

      var wallet = Db.Find<DbWallet>(walletId);
      
      await Db.WriteAsync(() =>  {   wallet.Alias = "some new value";   });
      
      var allWallets = Db.All<DbWallet>().ToList();
      

      Version

      8.0

      What Atlas Services are you using?

      Local Database only

      What type of application is this?

      Other

      Client OS and version

      Maui. Android emulator API 33 (pixel 5) on windows 11.

      Code snippets

      public partial class DbWallet : IRealmObject
      {
          [PrimaryKey]
          public string WalletId { get; set; }
          public string? Alias { get; set; }
      }
      

      Stacktrace of the exception/crash you're getting

      System.NotSupportedException: Realm.SyncSession is only valid for synchronized Realms (i.e. ones that are opened with FlexibleSyncConfiguration or PartitionSyncConfiguration). The unsupported member type is located on type 'Realms.Sync.Session'. Path: $.Realm.SyncSession.
       ---> System.NotSupportedException: Realm.SyncSession is only valid for synchronized Realms (i.e. ones that are opened with FlexibleSyncConfiguration or PartitionSyncConfiguration).
         at Realms.Realm.get_SyncSession() in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Realm.cs:line 247
      

      Relevant log output

      No response

            Assignee:
            ferdinando.papale@mongodb.com Ferdinando Papale
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: