title: DataTable internal index is corrupted Winforms C# - No clue how to fix
body: <p>I researched net for DataTable internal index is corrupted, however, no defined solution for this. Some suggest to avoid default view while others suggest to use AcceptChanges() etc. I have no clue where I should fix this as its a pretty big application. The exception happens in any field, no just consistent on one field, however, in the second code block below.</p>
  
  <p>I am a newbie, any help on this or suggestions, please. I can also provide any info you need more on this.</p>
  
  <p>This is the place I get exception.</p>
  
  <pre><code>[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
      public bool M_FLAG {
          get {
              return ((bool)(this[this.tableShip.M_FLAGColumn]));
          }
          set {
              this[this.tableShipment.M_FLAGColumn] = value;
          }
      }
  </code></pre>
  
  <p>This is being called by </p>
  
  <pre><code> if (!isInList(ShipEntities.SpecialServiceType.IdMDelivery) )                
   {
      shipment.Shipment[0].M_FLAG = false;
      shipment.Shipment[0].N_FLAG = false;
  
   }
  </code></pre>
  
  <p>Funny thing is, I get exception on second field "N" some other time.</p>
  
  <p>This is the part of exception detail:</p>
  
  <pre><code>System.InvalidOperationException: DataTable internal index is corrupted: '5'.
     at System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 mainTreeNodeID, Int32 position, Boolean append)
     at System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 mainTreeNodeID, Int32 position, Boolean append)
     at System.Data.RBTree`1.Insert(K item)
     at System.Data.Index.RecordStateChanged(Int32 oldRecord, DataViewRowState oldOldState, DataViewRowState oldNewState, Int32 newRecord, DataViewRowState newOldState, DataViewRowState newNewState)
     at System.Data.DataTable.RecordStateChanged(Int32 record1, DataViewRowState oldState1, DataViewRowState newState1, Int32 record2, DataViewRowState oldState2, DataViewRowState newState2)
     at System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Int32 position, Boolean fireEvent, Exception&amp; deferredException)
     at System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Boolean fireEvent)
     at System.Data.DataRow.SetNewRecord(Int32 record)
     at System.Data.DataRow.EndEdit()
     at System.Data.DataRow.set_Item(DataColumn column, Object value)
  </code></pre>