Silverlight Surprise

Just fixed an interesting little bug discovered late in pre-rollout testing.

Seems when your Silverlight application is installed in Out Of Browser mode you have to explicitly setup the culture for the UI thread – if you want something other than the default assigned to new OOB sessions.

Since I use the English language version of Windows and Silverlight the default culture is en-US even though my application installs while running under en-GB.

The answer was simple – when running in browser save the thread culture to local storage and when running out of browser set the thread culture explicitly from the saved state.

Incidentally this bug is only noticeable if you have XAML bindings that use binding converters or perhaps the StringFormat binding attribute.

In my program it showed itself in some dates shown on the UI where I use a custom converter to show UTC dates in local time.

Hope this helps somebody else – happy coding!

Advertisements