title: Realm deleting valid object raises "Attempted to access detached row" error
body: <p>I am trying to delete objects from realm database in a winForm dotnet application, but my code gives me this error</p>
  
  <blockquote>
    <p>Exception thrown: 'Realms.Exceptions.RealmInvalidObjectException' in
    Realm.dll An exception of type
    'Realms.Exceptions.RealmInvalidObjectException' occurred in Realm.dll
    but was not handled in user code Attempted to access detached row</p>
  </blockquote>
  
  <pre><code>Realm realm;
  IQueryable&lt;RObj&gt; items;
  
  public Form1()
      {
          InitializeComponent();
          var config = new RealmConfiguration("DB.realm");
          config.ShouldDeleteIfMigrationNeeded = true;
          realm = Realm.GetInstance(config);
          //WriteRealmTest();
      }
  
  private void Form1_Load(object sender, EventArgs e)
      {
          items = realm.All&lt;RObj&gt;();
  
          listboxMain.DisplayMember = "title";
          listboxMain.ValueMember = "id";
  
  
          BindingSource bs = new BindingSource();
          bs.DataSource = items;
          listboxMain.DataSource = bs;
  
      }
  
  private void listboxMain_KeyDown(object sender, KeyEventArgs e)
      {
          if (e.KeyCode == Keys.Delete)
          {
              int index = listboxMain.SelectedIndex;
              if (index &lt; 0) { return; }
              RObj item = items.ElementAt(index);
              if (!item.IsValid)
                  return;
              using (var trans = realm.BeginWrite())
              {
                  realm.Remove(item);
                  trans.Commit();            //when this line is commented, no error is raised
              }
  
          }
      }
  </code></pre>