In my localizable app I throw an ArgumentException like this:
throw ArgumentException("LocalizedParamName", "LocalizedErrorMessage");
And I catch it like this:
catch (Exception ex)
{
Display(ex.Message);
}
I'm getting the resulting error message as:
LocalizedErrorMessage Parameter name: LocalizedParamName
The problem here is "Parameter name: ", which is in english rather than my application's language. I suppoose that string is in the language of the .NET framework. Can anyone confirm that?
One workaround is doing this:
catch (ArgumentException ex)
{
Display((ex as Exception).Message + "\n" + "Translated(Parameter name:)"+ ex.ParamName);
}
catch (Exception ex)
{
Display(ex.Message);
}
Is there any other more elegant way?