1
Vote

Unhandled situation on import can cause application to crash when editing elements

description

I have exported spreadsheet for translations. After receiving it back and importing, on an attempt to open element for Editing application crashes.
 
Error received:
"The given key was not present in the dictionary."
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary2.get_Item(TKey key)
at System.Collections.ObjectModel.KeyedCollection
2.get_Item(TKey key)
at ResourceBlender.Express.ObservableDictionary`2.get_Item(TKey key) in D:\Projects\Personal\ResourceBlender\src\ResourceBlender-Express\ObservableDictionary.cs:line 107
at ResourceBlender.Express.WinAddElement.<LoadTranslatorComments>b__2(Object s, RunWorkerCompletedEventArgs rwe) in D:\Projects\Personal\ResourceBlender\src\ResourceBlender-Express\WinAddElement.xaml.cs:line 183
at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
 
 
After a bit of snooping around I have found that the header for one of the languages column was changed from "es-ES" to "es-ES " (with the space at the end.) probably by the translator. ResourceBlender imported the resources in rb_resource table and inserted the changed language code in "language" column. In the end, unable to find the "es-ES " language, application was crashing.
 
 
Suggestion:
Maybe on import, such critical fields like language column headers or values in resoruce column, could be checked and automatically trimmed from any spaces around the value?

comments