CultureInfo problem in dual-language system.

J

Jose Luis Bravo

Hellow,

We are using VS 2003 (C#) to develop applications running on a handheld
device over
Windows CE NET 4.2. The operating system used is made using Platform Builder
4.2,
(our system is based on a PXA255 proccessor) and our problem is the
following:

Some weeks ago, we started to use a new dual-language (spanish-english)
operating system
image and, suddenly, the applications we had been using with the previous OS
images
(only in spanish) stopped to work due to a generic
"PlatformNotSupportedException".
When we did some checks, we saw that, whatever the default language in the
SO be, spanish
or english, the applications only worked if we set the "regional settings"
to
"english-United States". We jumped over this problem for a time due to more
important issues, but
now we are trying to find a solution again...

After some research, what we have seen is this:
1) the exact point where the Exception is being thrown: when the application
launch the first
Form, his constructor call InitializeComponent() and, after defining a
ResourceManager object,
when it try to load a resource using GetObject() the Exception is thrown;
the information
shown is this:

CultureInfo::ctor+0xb3
CultureInfo::get_Parent+0x25
ResourceManager::InternalGetResourceSet+0x13b
ResourceManager::GetObject+0x2a
ResourceManager::GetObject+0x8
Form1::InitializeComponent+0x58
Form1::ctor+0xc
Form1::Main+0x5

So, apparently, it is due to a problem with the language settings, as it
could be expected...

2)
When i use both CultureInfo.CurrentCulture.LCID and
CultureInfo.CurrentUICulture.LCID on
the device, the returned value in both cases is 0x0c0a (matching with
spanish-international
sorting as it should). The two codes supported in our OS image are 0x0c0a
and 0x0409
(english-USA).

3)
Looking the documentation, it seems that ResourceManager should take the
resources associated
to the cultural reference of the current thread, that, according to what i
have explained,
should be 0x0c0a... so *i suppose* that the problem must be that the
resources included in
the binary are not associated with that reference, and maybe they are
associated with
0x0409, or something so...

Does anybody have an idea on what is happening? Maybe i should add some
compiler options to
force the association with the other cultural reference? if so, how it must
be done? I would
like to note that, indeed, there is nothing culture-specific in those
resources (they are
mostly bitmaps), so we don't want satellite assemblies or the like.

If somebody could give me an orientation, it would be greatly appreciated...


Thanks in advance.
 
F

Fernando

Hi Jose Luis,

There seems to be 2 different problems here. First could you please tell me
which exception you are seeing on:

CultureInfo::ctor+0xb3
| CultureInfo::get_Parent+0x25
| ResourceManager::InternalGetResourceSet+0x13b
| ResourceManager::GetObject+0x2a
| ResourceManager::GetObject+0x8
| Form1::InitializeComponent+0x58
| Form1::ctor+0xc
| Form1::Main+0x5
|

I would expect this exception to be caused by the fact that the sattelite
assemblies are not present under the specific directory, for example
--> Myapp.exe
-->es (directory were satellite assemblies should be present).

And also that the neutral resource is not embedded on the main executable
(just run ildasm.exe over the main assembly to verify this)

The user interface culture is the one that the system uses as the default
to locate the resources files. For example if english-US is set you would
need to have the resources under an en-US folder on the apps directory.

A PlatfornNotSupportedException gets raised when a CultureInfo object tries
to create a culture that's is not supported by the OS, could you please
show me the call stack for this exception?

Thx
Fernando


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Reply-To: "Jose Luis Bravo" <[email protected]>
| From: "Jose Luis Bravo" <[email protected]>
| Subject: CultureInfo problem in dual-language system.
| Date: Mon, 19 Jan 2004 09:04:31 +0100
| Lines: 82
| Organization: MIPSA
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 237.red-80-34-208.pooles.rima-tde.net 80.34.208.237
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!cpmsftngxa09.phx.gbl!TK2MSFTNGP08.
phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:43370
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
|
| Hellow,
|
| We are using VS 2003 (C#) to develop applications running on a handheld
| device over
| Windows CE NET 4.2. The operating system used is made using Platform
Builder
| 4.2,
| (our system is based on a PXA255 proccessor) and our problem is the
| following:
|
| Some weeks ago, we started to use a new dual-language (spanish-english)
| operating system
| image and, suddenly, the applications we had been using with the previous
OS
| images
| (only in spanish) stopped to work due to a generic
| "PlatformNotSupportedException".
| When we did some checks, we saw that, whatever the default language in the
| SO be, spanish
| or english, the applications only worked if we set the "regional settings"
| to
| "english-United States". We jumped over this problem for a time due to
more
| important issues, but
| now we are trying to find a solution again...
|
| After some research, what we have seen is this:
| 1) the exact point where the Exception is being thrown: when the
application
| launch the first
| Form, his constructor call InitializeComponent() and, after defining a
| ResourceManager object,
| when it try to load a resource using GetObject() the Exception is thrown;
| the information
| shown is this:
|
| CultureInfo::ctor+0xb3
| CultureInfo::get_Parent+0x25
| ResourceManager::InternalGetResourceSet+0x13b
| ResourceManager::GetObject+0x2a
| ResourceManager::GetObject+0x8
| Form1::InitializeComponent+0x58
| Form1::ctor+0xc
| Form1::Main+0x5
|
| So, apparently, it is due to a problem with the language settings, as it
| could be expected...
|
| 2)
| When i use both CultureInfo.CurrentCulture.LCID and
| CultureInfo.CurrentUICulture.LCID on
| the device, the returned value in both cases is 0x0c0a (matching with
| spanish-international
| sorting as it should). The two codes supported in our OS image are 0x0c0a
| and 0x0409
| (english-USA).
|
| 3)
| Looking the documentation, it seems that ResourceManager should take the
| resources associated
| to the cultural reference of the current thread, that, according to what i
| have explained,
| should be 0x0c0a... so *i suppose* that the problem must be that the
| resources included in
| the binary are not associated with that reference, and maybe they are
| associated with
| 0x0409, or something so...
|
| Does anybody have an idea on what is happening? Maybe i should add some
| compiler options to
| force the association with the other cultural reference? if so, how it
must
| be done? I would
| like to note that, indeed, there is nothing culture-specific in those
| resources (they are
| mostly bitmaps), so we don't want satellite assemblies or the like.
|
| If somebody could give me an orientation, it would be greatly
appreciated...
|
|
| Thanks in advance.
|
|
|
|
|
|
 
J

Jose Luis Bravo

"Fernando" said:
Hi Jose Luis,

There seems to be 2 different problems here. First could you please tell me
which exception you are seeing on:

CultureInfo::ctor+0xb3
| CultureInfo::get_Parent+0x25
| ResourceManager::InternalGetResourceSet+0x13b
| ResourceManager::GetObject+0x2a
| ResourceManager::GetObject+0x8
| Form1::InitializeComponent+0x58
| Form1::ctor+0xc
| Form1::Main+0x5
|

"PlatformNotSupportedException", this is what i was talking about all the
time.
I would expect this exception to be caused by the fact that the sattelite
assemblies are not present under the specific directory, for example
--> Myapp.exe
-->es (directory were satellite assemblies should be present).

Yeah, but, as i said, there was nothing culture-specific in the resources
(they are bitmaps), so we didn't want sattelite assemblies; it should be
linked
with the invariant culture, i guess. The main question is: why the fallback
specific
culture -> generic culture -> invariant culture was failing?...
And also that the neutral resource is not embedded on the main executable
(just run ildasm.exe over the main assembly to verify this)

Ummm, that make sense; well, it would make... i mean: yesterday afternoon
we
did a test making a OS image supporting the two codes we had (0x0409 and
0x0c0a) and adding 0x040a (that match with "Spanish-traditional sorting").
It
worked fine, so this exclude the possibility that the resources weren't
there
(furthermore, the programs worked fine using as regional settings
english-USA,
so it was clear that the resources were embedded on the executable). This
seems to have solved the problem, but i'm now completely confused...
a couple of days ago, due to the fact that the 2 spanish settings
(traditional and international) are widely used, we suspected that it could
be
the cause of our problem, so, to check if the problem was there, i looked
both the configuration in the system (that was, as it should,
spanish-international)
and the codes returned by the application in execution time (that, as i
posted,
were 0x0c0a in both CultureInfo.CurrentCulture.LCID and
CultureInfo.CurrentUICulture.LCID.)
So... OK, the system work, but i'm missing the cause of the problem...
why it failed? Looking at the call stack, it seems that
CultureInfo::get_Parent was
having called, that make sense with this schema: after retrieving the
current
cultureInfo (0x0c0a), GetObject tried to get the resource associated with
that and,
after failing (because the resources weren't associated with any specific
culture), it
tried to get the spanish neutral culture and failing in the attempt. Why?
and why
adding 0x040a solve the problem? Definitely, i'm missing something here...


Thanks for the try, Fernando ;)
 

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