Getting the English strings from the framework?

Y

Ympostor

Hello. I'm concerned that some of my customers may use non-English
versions of the .NET framework and thus their exceptions/errors appear
translated, so:

a) Any part of our code that relies on the content of the exception may
fail.
b) Bug reports that include stacktraces may contain words in other
language different than English, making it more difficult for the fixer
to figure out what happens.

So I'm wondering, can the application tell the framework to switch to an
English (en-US, I guess the default) culture and only give messages this
way? Or is this not supported?

I've already googled a bit and I find no information. The closest thing
I found is:

http://www.informit.com/articles/printerfriendly.asp?p=664144&rl=1

Thanks in advance.
 
P

Pavel Minaev

Hello. I'm concerned that some of my customers may use non-English
versions of the .NET framework and thus their exceptions/errors appear
translated, so:

a) Any part of our code that relies on the content of the exception may
fail.

No part of your code should rely on the content of Exception.Message,
ever!
b) Bug reports that include stacktraces may contain words in other
language different than English, making it more difficult for the fixer
to figure out what happens.

The stack trace will still be correct, obviously. Also, it is
precisely why it is a good idea to encode all relevant information
about exceptions that you throw in separate fields on the exception
object, and not just the message text.
So I'm wondering, can the application tell the framework to switch to an
English (en-US, I guess the default) culture and only give messages this
way? Or is this not supported?

Maybe if you switch the culture for your thread... but even then
that's usually a bad idea. User is entitled to expect whatever
settings he has made for his locale to be respected by the apps.
 
A

Andrew Morton

Ympostor said:
Hello. I'm concerned that some of my customers may use non-English
versions of the .NET framework and thus their exceptions/errors appear
translated, so:

a) Any part of our code that relies on the content of the exception
may fail.

I suspect that you need to catch specific exceptions before general ones,
which you can do with multiple catch blocks:

http://msdn.microsoft.com/en-us/library/8a9f2ew0(VS.80).aspx

Or maybe you need to check the ErrNum rather than the Message.

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top