Bug Report and Resolution for "The given key was not present in the dictionary"

Bug Report and Resolution for "The given key was not present in the dictionary"

  

If you are getting this Message "The given key was not present in the dictionary." and an exception that looks like this:

The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at OutSystems.HubEdition.RuntimePlatform.BaseAppUtils.#TDb(IDMLIdentifiers dmlIdentifiers, Match m, String[] entityNames, String[] entityAliases, IDictionary`2[] entityAttributesNamesToDatabaseNames)
   .....


Then 95% of the time it is caused by a line in a aggregate's SORT like this:

    List_SortColumn_GetOrderBy(SplitTable.Id, "{Split}.[TransactionType]")

Where the column no longer exists in a given table.  The generated server shouldn't crash like this, therefore, this is a bug.  To fix, obviously, revise this line appropriately.

Great tip Ian! 

Thanks for sharing!
R