Consolidations: ArgumentException: An item with the same key has already been added.

Consolidations: ArgumentException: An item with the same key has already been added.

Issue/Error Message: When consolidating, you get the following error:

 

ArgumentException

An item with the same key has already been added.

   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)

   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)

   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)

   at Forecast5.Model.Consolidation.OnOpenForecast()

   at Forecast5.Model.Forecast.Open(Node node)

   at Forecast5.ViewModel.MainWindowViewModel.OpenForecast(Nullable`1 forecastNodeId)

   at Forecast5.ViewModel.SelectDatabaseForecastViewModel.OnClosingOk()

   at Forecast5.ViewModel.DialogViewModel.Ok()

   at Forecast5.View.MainWindow.ok_Click(Object sender, RoutedEventArgs e)

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)

 

Solution:

This is caused by attempting to consolidate when two forecasts have slight variations of a record name, e.g. Forecast 1 – Sales record = “Sales”                   Forecast 2 - Sales record = “sales”.


To resolve, update to version 3.1.041 or above or fix the names to match.


Download the latest version here: www.forecast5.com/release


    • Related Articles

    • Consolidations: Key Not Found Exception - Given key not present in the dictionary

      Issue: KeyNotFoundException The given key was not present in the dictionary   This error message can occur when record names in the base forecast of a consolidation have been changed. Solution: The consolidation looks for the record name that is ...
    • License - The Given Key Was Not Present In The Dictionary

      Issue: When trying to run Forecast 5, you get the error message below: "The given key was not present in the dictionary"   Solution: Contact support@forecast5.com with the name of the computer you are having the issues with. They will clear the ...
    • Install Issue: Could not write value Installed to key.

      Could not write value Installed to key. The error message below occurs during installation if the user installing does not have adequate permissions.   Solution: Run REGEDIT (if you cannot run this, you will need to log in as administrator to ...
    • Consolidations: An error has occurred while creating/opening the forecast.

      Issue: When trying to complete a consolidation, you are receiving the following error: "An error has occured while creating/opening the forecast. If this is a consolidation, please check that all records are named correctly to avoid duplicate record ...
    • Consolidation Rules for Forecast 5

      In order to successfully create a consolidation in Forecast 5, there are some rules and tips to be followed: Rules The forecasts must all have the same start date and number of years. The forecasts must be in the same state e.g. budget, actuals or ...