Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
66 views
in Technique[技术] by (71.8m points)

How to completely avoid localized .NET exception messages

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.

question from:https://stackoverflow.com/questions/13272323/how-to-completely-avoid-localized-net-exception-messages

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...