Aside

.NET DataTable: Exception in ColumnChanged event disables change tracking?

In the official MSDN documentation for .NET DataTable, it says:

Do not throw a NullReferenceException within the RowChanged event handler. If a NullReferenceException is thrown within the RowChanged event of a DataTable, then the DataTable will be corrupted.

I found, as well, that throwing ANY type of Exception within a ColumnChanged event handler would cause the change tracking (row state) to stop working (at least for those fields that were in error). I didn’t investigate this in detail, but the documentation for validation explicitly states that you CAN throw exceptions in ColumnChanging and the other ‘ing events, but makes no mention of the ‘ed events.

So I changed the event from ‘ed to ‘ing and the problem went away.

Comments are closed.