I ran into an odd Silverlight Beta 1 problem after releasing the latest version of "Sort the Foobars" - the game worked fine for me in testing, but shortly after putting it up on this site I received several comments about it crashing in different locales, like Russian and French (you can see those comments here)
The exception looked something like this:
Silverlight error message
ErrorCode: 4002
ErrorType: ManagedRuntimeError
Message: System.Exception: Défaillance irrémédiable (Error 0x1709. Debugging resource strings are unavailable. See http://go.microsoft.com/fwlink/?linkid=106663&Version=2.0.30226.2&File=mscorrc.dll&Key=0x1709 0x8000FFFF (E_UNEXPECTED)) at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.SetValue(IntPtr oPtr, UInt32 iPropertyId, String s)
at MS.Internal.XcpImports.SetValue(IntPtr oPtr, UInt32 iPropertyId, Object obj)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean isSetByStyle, Boolean isSetByBuiltInStyle)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
So the first question is, how do you set up your development machine to test the other locales? It turns out this part is easy - go to Control Panel/Regional Settings and set the language to, say Russian.
After doing that, I found that this was the line of code that was dying:
this.SetValue(Canvas.LeftProperty, X)
Not much to that… “this” is a UserControl and (here is the key part!) “X” is a float. So apparently, setting the left property to a float is bad outside of en-us J
I added a Convert.ToDouble(X) in there and it seems happy now:
this.SetValue(Canvas.LeftProperty, Convert.ToDouble(X))
So the moral of the story? I think that the different behavior is hopefully because this is still a Beta release of Silverlight... Because we would really hope for consistent behavior between Locales! But on the other hand, you still need to be careful with setting Dependency properties to types that they aren't suited for!