Print Page | Close Window

App crash because of Locale settings??

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=578
Printed Date: 16-Aug-2018 at 7:31am


Topic: App crash because of Locale settings??
Posted By: Dominique
Subject: App crash because of Locale settings??
Date Posted: 04-Dec-2007 at 6:52am
Hi,
I have a client who get the error message pasted under.
He is using an english version of XP pro with SP2. The app worked fine on his laptop when he tried it.
Do you have any clue of wha could be happening? I see that the "Cannot add a DataRelation or Constraint that has different Locale or CaseSensitive settings between its parent and child tables." part shows up on google.

what is being done in the last to lines of the stack is creating a new entity and then testing some child-properties to set some default values.

Dominique


************** Exception Text **************
IdeaBlade.Util.IdeaBladeException: Unable to create DataRelation 'TRANSPORTOR_PRODUKT' ---> System.ArgumentException: Cannot add a DataRelation or Constraint that has different Locale or CaseSensitive settings between its parent and child tables.
   at System.Data.DataRelationCollection.AddCore(DataRelation relation)
   at System.Data.DataRelationCollection.DataSetRelationCollection.AddCore(DataRelation relation)
   at System.Data.DataRelationCollection.Add(DataRelation relation)
   at IdeaBlade.Persistence.EntityRelation.ToDataRelation(DataSet pDataSet, Boolean pCreateConstraint)
   --- End of inner exception stack trace ---
   at IdeaBlade.Persistence.EntityRelation.ToDataRelation(DataSet pDataSet, Boolean pCreateConstraint)
   at IdeaBlade.Persistence.PersistenceManager.ResolveEntityRelation(EntityRelation pEntityRelation)
   at IdeaBlade.Persistence.PersistenceManager.XFindEntities(ICollection pEntities, EntityRelationLink pEntityRelationLink, WorkState pWorkState)
   at IdeaBlade.Persistence.PersistenceManager.XGetRelated(ICollection pEntities, EntityRelationLink pRelationLink, QueryStrategy pQueryStrategy, WorkState pWorkState)
   at IdeaBlade.Persistence.PersistenceManager.GetChildren[T](Entity pEntity, EntityRelation pEntityRelation, QueryStrategy pQueryStrategy, Boolean pReturnsManagedList)
   at IdeaBlade.Persistence.Entity.GetManagedChildren[T](EntityRelation pEntityRelation, QueryStrategy pStrategy)
   at IdeaBlade.Persistence.Entity.GetManagedChildren[T](EntityRelation pEntityRelation)
   at Entity.TRANSPORTORDataRow.GetPRODUKTsImpl()
   at Entity.TRANSPORTORDataRow.get_PRODUKTs()
   at Entity.BRUKER.AddNewFrbrHode(String frbrNummer)
   at webbooking_gui.FrmMain.DoGetNyttOppdrag(Boolean& shouldReturn)



-------------
Dominique



Replies:
Posted By: davidklitzke
Date Posted: 04-Dec-2007 at 8:57am
We have seen this problem before.  The problem is (as the error message states) that you "Cannot add a DataRelation or Constraint that has different Locale or CaseSensitive settings between its parent and child tables".  In other words, you have a situation where, for example, the "Order" table uses the French locale, and its child table ("OrderDetail") uses the German locale.
 
The application works on the machine where both tables use the same locale, while the application fails on the other machine where both tables are using different locales.


Posted By: Dominique
Date Posted: 04-Dec-2007 at 10:41am
Hi David,

Thanks for your reply

Originally posted by davidklitzke

... 
The application works on the machine where both tables use the same locale, while the application fails on the other machine where both tables are using different locales.


Just to be sure, you are referring to tables in the database, not dotnet in-memory tables, right?
I am wondering how this could happen because the app is deployed as an n-tier application using a BOS to communicate to the database.
I tried reproducing the issue from an English windows server 2003  without getting the problem.
 
None of the user control is localisable but I noticed that the IME type of some of the user controls was set to the hakara ( or another japanese IME type) so I set them back to noControl (how they 've been set to this value is a mystery)

Do you have any advice of where I could fix the problem? in the DB or in the app?




-------------
Dominique


Posted By: davidklitzke
Date Posted: 04-Dec-2007 at 8:31pm

I don't think I am going to be much help on this problem, but I'll to explain as much as I have been able to discover.

 

First, this is not a DevForce problem or a database problem.  It's a problem caused by a locale or case-sensitivity incompatability between child and parent in a DataSet relation.

 

Here are a few examples of some incidents that I have found on the web that give the same exact error:

 

(1) Somewho had a problem and then discovered a solution (i.e., remove reference to unused table adapter)


http://www.eggheadcafe.com/software/aspnet/29213046/dataset-locale-problem.aspx - http://www.eggheadcafe.com/software/aspnet/29213046/dataset-locale-problem.aspx

 

 

(2) Cannot load XSD on a computer with a different regional setting.

 

http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=106466 - http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=106466

 

Visual Studio and .NET Framework
Feedback Workarounds

106466.

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=106466 - When trying to open a Visual Studio solution containing a typed dataset, I get this error: Load DataSet Error Failed to load dataset because of the following error: Cannot add a DataRelation or Constraint that has different Locale or CaseSensitive settings between its parent and child tables.

 “DataTable.CaseSensitive" problem

 

http://www.developerfood.com/datatable-casesensitive-problem/microsoft-public-dotnet-framework-adonet/eb7a58e0-bac3-47c1-bba6-6c225392e0ae/article.aspx - http://www.developerfood.com/datatable-casesensitive-problem/microsoft-public-dotnet-framework-adonet/eb7a58e0-bac3-47c1-bba6-6c225392e0ae/article.aspx


"Cannot add a DataRelation or Constraint that has different Locale or
CaseSensitive settings between its parent and child table"

The "DataTable.CaseSensitive" property is the cause because it's on for one
table but not the other. The relation is a standard foreign key relation
between two integer keys however (there are no other relations) so I don't
see why this error should exist. I need the "CaseSensitive" property on for
one of these tables however but not the other since it effects searching via
"DataTable.Select()" for instance. Can anyone comment on this situation.
Thanks.



Posted By: Dominique
Date Posted: 06-Dec-2007 at 11:59pm
Hi,
Just a quick answer to inform you that I "solved" the issue by removing the table (and relation) that triggered the fault. It worked by now because this table is not in use yet.
This actually doesn't solve the cause of the problem wich remains unknown for me. I.e. Why did I get this dataset related problem in the first place?
Fyi I scout all the code to check if I was doing something at the dataset level.

-------------
Dominique


Posted By: lars-erik
Date Posted: 11-Nov-2008 at 7:10am
 
I have the same problem when running my application at a Lithuanian PC:
 
"..Cannot add a DataRelation or Constraint that has different Locale or CaseSensitive settings between its parent and child tables..."
 
Please help someone.


Posted By: davidklitzke
Date Posted: 11-Nov-2008 at 11:01am
My understanding is that this happens because one of your parent objects has a different locale or CaseSensitive setting than one one of its children.   This doesn't usually happen on a single machine, but could easily happen when you deploy business objects built on the client to a remote server where Client and Server machines may have different Locale or CaseSensitive settings.


Posted By: lars-erik
Date Posted: 11-Nov-2008 at 11:31pm
Well my developer machine and the remoting server are both running an english win2003 with norwegian in regional settings.
When running the application from my own laptop, I have no trouble.
If I change to language to Lithuanian in regional settings, I get the  locale / casesensitive error.
Does this mean the end user machines and the remoting server are not able to have differenent language settings ? If so, this is a major weakness.
 
Will the following help:

Thread.CurrentThread.CurrentCulture = ci;

Thread.CurrentThread.CurrentUICulture = ci;
 
..where ci is the english culture.


Posted By: davidklitzke
Date Posted: 12-Nov-2008 at 2:43pm
I have not had the chance to test any of this out with a real example, so do not take any of my suggestions or statements as absolute truth.
 
What I think that you need to do is to set your PM Locale and CaseSensitive settings on the client to matcch those in effect on the BOS.  I'm not sure whether what is on the BOS has to be the same as what's in the DB.
 
We do have properties on the PM for both Locale and CaseSensitive.  These were added to ensure that the local DataSet had the same settings on the client as on the server.  You can try setting these properties on the PM to see if that resolves the problem.  I think that these properties need to be set early before any queries are performed.
 
I believe that you are seeing it N-Tier, but not 2-Tier, because a DataSet and DataTables are created on the BOS when a query is run then shipped back to the client.  They are defaulting to the culture info on the BOS server, which is apparently different than on the client machine.

 




Print Page | Close Window