Culture Name Error

Culture Name Error

Old forum URL: forums.lhotka.net/forums/t/6871.aspx


jfreeman posted on Wednesday, April 29, 2009

We just had some users in Singapore start using an application built with CSLA 3.5 and I am getting a strange error.  Here is the error:

DataPortal.Fetch failed (Culture name 'en-sg' is not supported. Parameter name: name)

I know it has something to do with the language settings but can someone help me with why this is happening?  How do I get 'en-sg' to be supported?  Thanks.

Jonathan

 

 

 

ajj3085 replied on Wednesday, April 29, 2009

You probably need to build a resx dictionary for the culture en-sg.

jfreeman replied on Wednesday, April 29, 2009

How and where do I build that file?  Thanks.

Jonathan

Fintanv replied on Wednesday, April 29, 2009

You will need to create a new culture specific resources file in the CSLA solution. 

RockfordLhotka replied on Thursday, April 30, 2009

That really shouldn't be the case (the need to create a new resx), because .NET should fall back to using the default resx (US english).

Can you look at the stack trace to see exactly what component is failing?

Is that really a valid culture name? Maybe it is .NET or Windows that simply doesn't recognize that culture string.

Or maybe there's a language pack you need to install at the OS level to enable that culture?

jfreeman replied on Thursday, April 30, 2009

EN-SQ stands for English (Singapore).  From what I've found so far, this language only became available with Vista so I cannot install it on my XP box.  I have created a resource file for en-sg but when I compile on an XP box it does not create the subfolder and dll.  I compiled it on a Vista machine and the subfolder and dll did get created.  I am in the process of setting up a Vista machine to use as a build box for this application.  I guess I may upgrade to Vista but I'm trying to hold off for now.

I thought it would default back to US English based on other things I've read but it appears it isn't.  Any other thoughts or ideas?

I've included the stack trace for the error in case you want to see it. 

Thanks for your help.

Jonathan

 

Csla.DataPortalException: DataPortal.Fetch failed (Culture name 'en-sg' is not supported.
Parameter name: name) ---> System.ArgumentException: Culture name 'en-sg' is not supported.
Parameter name: name
   at System.Globalization.CultureTableRecord..ctor(String cultureName, Boolean useUserOverride)
   at System.Globalization.CultureTableRecord.GetCultureTableRecord(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name)
   at Csla.Server.DataPortal.SetContext(DataPortalContext context) in C:\CSLA\3.5\C#\cslacs\Csla\DataPortal\Server\DataPortal.cs:line 299
   at Csla.Server.DataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context) in C:\CSLA\3.5\C#\cslacs\Csla\DataPortal\Server\DataPortal.cs:line 94
   --- End of inner exception stack trace ---
   at System.Globalization.CultureTableRecord..ctor(String cultureName, Boolean useUserOverride)
   at System.Globalization.CultureTableRecord.GetCultureTableRecord(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name)
   at Csla.Server.DataPortal.SetContext(DataPortalContext context) in C:\CSLA\3.5\C#\cslacs\Csla\DataPortal\Server\DataPortal.cs:line 299
   at Csla.Server.DataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context) in C:\CSLA\3.5\C#\cslacs\Csla\DataPortal\Server\DataPortal.cs:line 94
   at Csla.DataPortal.Fetch(Type objectType, Object criteria)
   at Csla.DataPortal.Fetch[T](Object criteria)
   at STR.STRG_Explorer.Library.BLL.RefSearchList.GetRefSearchList(String formName)
   at STR.STRG_Explorer.SearchForm.SearchForm_Load(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


RockfordLhotka replied on Thursday, April 30, 2009

The exception is coming from .NET, because it can’t set the culture. I suspected that was the case.

 

So either .NET or Windows (and I suspect Windows) doesn’t support that culture. You’ll have to figure out a way for the OS to support the culture, or stop the data portal from trying to set the culture to the invalid value.

 

Unfortunately there’s no hook to do this. The data portal sets the context before doing anything else, and there’s never been a need for that to be extensible. This means you’ll probably need to alter Csla.Server.DataPortal – just change the SetContext() method to look for a culture of name “en-sg” and replace it with something valid.

 

Rocky

 

 

From: jfreeman [mailto:cslanet@lhotka.net]
Sent: Thursday, April 30, 2009 1:34 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Culture Name Error

 

EN-SQ stands for English (Singapore).  From what I've found so far, this language only became available with Vista so I cannot install it on my XP box.  I have created a resource file for en-sg but when I compile on an XP box it does not create the subfolder and dll.  I compiled it on a Vista machine and the subfolder and dll did get created.  I am in the process of setting up a Vista machine to use as a build box for this application.  I guess I may upgrade to Vista but I'm trying to hold off for now.

I thought it would default back to US English based on other things I've read but it appears it isn't.  Any other thoughts or ideas?

I've included the stack trace for the error in case you want to see it. 

Thanks for your help.

Jonathan

 

Csla.DataPortalException: DataPortal.Fetch failed (Culture name 'en-sg' is not supported.
Parameter name: name) ---> System.ArgumentException: Culture name 'en-sg' is not supported.
Parameter name: name
   at System.Globalization.CultureTableRecord..ctor(String cultureName, Boolean useUserOverride)
   at System.Globalization.CultureTableRecord.GetCultureTableRecord(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name)
   at Csla.Server.DataPortal.SetContext(DataPortalContext context) in C:\CSLA\3.5\C#\cslacs\Csla\DataPortal\Server\DataPortal.cs:line 299
   at Csla.Server.DataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context) in C:\CSLA\3.5\C#\cslacs\Csla\DataPortal\Server\DataPortal.cs:line 94
   --- End of inner exception stack trace ---
   at System.Globalization.CultureTableRecord..ctor(String cultureName, Boolean useUserOverride)
   at System.Globalization.CultureTableRecord.GetCultureTableRecord(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name)
   at Csla.Server.DataPortal.SetContext(DataPortalContext context) in C:\CSLA\3.5\C#\cslacs\Csla\DataPortal\Server\DataPortal.cs:line 299
   at Csla.Server.DataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context) in C:\CSLA\3.5\C#\cslacs\Csla\DataPortal\Server\DataPortal.cs:line 94
   at Csla.DataPortal.Fetch(Type objectType, Object criteria)
   at Csla.DataPortal.Fetch[T](Object criteria)
   at STR.STRG_Explorer.Library.BLL.RefSearchList.GetRefSearchList(String formN ame)
   at STR.STRG_Explorer.SearchForm.SearchForm_Load(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message & m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 



jfreeman replied on Thursday, April 30, 2009

Rocky,

So even if I create the resource file it won't fix my problem? 

Jonathan

RockfordLhotka replied on Thursday, April 30, 2009

I don’t know – maybe it will. But it appears that the OS is not accepting the culture value, so I’d be surprised if that fixed the issue.

 

Rocky

 

 

From: jfreeman [mailto:cslanet@lhotka.net]
Sent: Thursday, April 30, 2009 2:25 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] RE: Culture Name Error

 

Rocky,

So even if I create the resource file it won't fix my problem? 

Jonathan



Copyright (c) Marimer LLC