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

Realm throwing ArgumentNullException when value is actually not null

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      While trying to add data into realm db, "value cannot be null" exception is thrown, even though it is found to be not null while debugging.

      StackTrace:

      ERROR: Exception: System.ArgumentNullException
      StackTrace: at Realms.Helpers.Argument.NotNull (System.Object value, System.String paramName) [0x00003] in C:\jenkins\workspace\realm_realm-dotnet_PR\Realm\Realm\Helpers\Argument.cs:64
      at Realms.Realm.AddInternal (Realms.RealmObject obj, System.Type objectType, System.Boolean update) [0x00000] in C:\jenkins\workspace\realm_realm-dotnet_PR\Realm\Realm\Realm.cs:541
      at Realms.Realm.Add[T] (T obj, System.Boolean update) [0x00006] in C:\jenkins\workspace\realm_realm-dotnet_PR\Realm\Realm\Realm.cs:509
      at NetherDemo.RLMDB.Nether.ListJSONData+RealmHelper.CopyToRealm (Realms.RealmObject instance, System.Boolean update, System.Boolean skipDefaults) [0x0011a] in <bc6c5d71c4aa4c65a4b505abfe641abe>:0

      Code Sample

      public T Add<T>(T obj, bool update = false) where T : RealmObject
      => Realm.Add(obj, update);

      Here error shows:
      Realm.AddInternal (Realms.RealmObject obj, System.Type objectType, System.Boolean update)
      System.ArgumentNullException: Value cannot be null. Parameter name: obj

      But "obj" and it's components are not null as I've seen while debugging.

      Versions:

      Realm 4.1.0 (Didn't upgrade as there is a debugger connectivity issue in 4.2.0)
      Xamarin.Forms 4.4.0.991537
      Visual Studio for MAC 8.4.3
      macOS Mojave 10.14.5

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: