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

Ian Johnstone wrote:

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.


Was very helpful here, thank you very much.

Hi guys,

I also saw this while upgrading to P10.

This happens to me when a database column was removed. It still exists on the database, that's why it keeps working on < P10 (P9,8..)

This is a good protection from P10, because this kind of mistakes can be detected right away, instead of being detected when doing maintenance on the DB (removing old columns not in use anymore).

Kudos to OutSystems! :)