G
GB
All,
I raised a problem a while ago about custom cultures in .NET and an
error whereby a "Resource lookup failed - infinite recursion detected"
exception was raised. Usually this was raised when the custom culture
was in use and the application domain was restarted.
Anyway, there was nothing on usenet about a solution but eventually I
came across one (well, MS provided it themselves when I challenged them
about this).
In some situations the localisation plumbing uses the class hash code
behind the scenes. If your custom culture class is not overridding this
then the .NET framework can get confused as the custom culture class
looks identical to its parent (in my case my custom welsh object looked
identical to its parent en-GB object). Override the hash code in the
custom object;
public override int GetHashCode()
{
return (this.Name.GetHashCode());
}
Hey, presto... problem solved.
Cheers.
I raised a problem a while ago about custom cultures in .NET and an
error whereby a "Resource lookup failed - infinite recursion detected"
exception was raised. Usually this was raised when the custom culture
was in use and the application domain was restarted.
Anyway, there was nothing on usenet about a solution but eventually I
came across one (well, MS provided it themselves when I challenged them
about this).
In some situations the localisation plumbing uses the class hash code
behind the scenes. If your custom culture class is not overridding this
then the .NET framework can get confused as the custom culture class
looks identical to its parent (in my case my custom welsh object looked
identical to its parent en-GB object). Override the hash code in the
custom object;
public override int GetHashCode()
{
return (this.Name.GetHashCode());
}
Hey, presto... problem solved.
Cheers.