When an error occurs in my .NET applications, i get an exception message in (in my case) swedish. This is useless for most purposes because.
The message is often just a poorly translated version of the original (english) exception message [1]
Exception messages are mosly used to diagnose problems, and that usually includes googling for the error messages. This means guessing or using a web service to find the original english message.
[1] I'm not joking. Example: "Calling assembly" in the context of a binding failure is completely obfuscated. It is translated to "called assembly" because of how english uses the same word for the one that is calling as for the one it is calling. Almost as if someone used a dictionary to translate it word by word.
So what I want: I want to be able to get english exception messages, consistently, on a non-english windows install (I do not want to change the thread culture of the application).
There is a similar question ( Exception messages in English? ) , but that is in the concept of logging. On that level I could just change the thread culture.
But I want the change to be global, and include "not my code" exceptions as well.
Is there any way this can be configured or "hacked" (e.g. by replacing resource files)? Am I the only person thinking that translating exception messages to begin with, is a horrible design flaw in .NET?
I'm sorry if this was part rant and part question.
Another way to avoid exceptions is to return null (or default) for extremely common error cases instead of throwing an exception. An extremely common error case can be considered normal flow of control. By returning null (or default) in these cases, you minimize the performance impact to an app.
You can define and use custom exceptions if you're building a library or framework, and you want consumers of that library to react to exceptions from the library differently than they would do for built-in exception types.
From Best Practices for Exceptions† on MSDN in the section "Creating and raising exceptions": Use grammatically correct error messages, including ending punctuation. Each sentence in a description string of an exception should end in a period.
Remove any .NET language packs. According to this ("The .NET Framework 4.5 Language Pack contains translated error messages and other UI text for languages other than English. If you don't install a language pack, this text is displayed in English"), it should be enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With