4458
Views
9
Comments
Bug Report and Resolution for "The given key was not present in the dictionary"
Question

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.

2018-06-11 09-12-53
Rodrigo Coutinho
Staff

Great tip Ian! 

Thanks for sharing!
R

2022-06-17 09-22-26
Huarlem Lima

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.

2022-08-05 20-06-58
Hélder Anselmo

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! :)

UserImage.jpg
Nitish Gupta

Thanks. It worked !

2023-01-02 21-10-39
Gonçalo Barata

Thanks. You "saved my life" :)

2019-03-08 16-12-38
Marcos Galigarcia

Ian's tip continues to be helpful in version 11.

2021-08-30 14-04-44
Maykon Nogueira

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.

Very Nice, Thanks!


2019-06-25 08-42-03
gbarbosa

Nice, this helped! thanks!

2021-08-11 17-58-13
Heidi Silva

Very good, it solved for me too. Thanks

2023-06-09 08-38-19
Snowfl

Nice, this helped! thanks! 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.