Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Gif not animated on iOS when using different DefaultThreadCurrentCulture #14696

Closed
e1T opened this issue Oct 5, 2021 · 0 comments · Fixed by #14698
Closed

[Bug] Gif not animated on iOS when using different DefaultThreadCurrentCulture #14696

e1T opened this issue Oct 5, 2021 · 0 comments · Fixed by #14698

Comments

@e1T
Copy link

e1T commented Oct 5, 2021

Setting the CultureInfo.DefaultThreadCurrentCulture to some different values than 'en-US' can result in .gif images not animating on iOS. On Android the gif is animating correctly as expected.

Not working correctly:

CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("nl-NL");
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("de-DE");
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("es-ES");

I have tried a few different values, and these seem to work correctly however:

CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fr-FR");
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("ru-RU");

Steps to reproduce:

  1. Generate a sample app (e.g. TipCalc)
  2. In TipCalc.Core/App.cs add the line defining the DefaultThreadCurrentCulture
  3. Add an animated gif to the view, e.g. <Image Source="office.gif" IsAnimationPlaying="True" />

EDIT:
It seems to be caused by the ImageAnimationHelper in Xamarin.Forms.Platform.iOS on line 54:

double.TryParse(unclampedDelayTimeValue.ToString(), out delayTime);

In the Xamarin.Forms Control Gallery this results in a value of 0.33 to be parsed as 33.

The solution which seems to fix the issue is to ignore the thread culture, e.g.:

double.TryParse(unclampedDelayTimeValue.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out delayTime);

The same probably applies to line 56.

@jsuarezruiz jsuarezruiz added t/bug 🐛 s/unverified New report that has yet to be verified p/iOS 🍎 a/image labels Oct 5, 2021
@jsuarezruiz jsuarezruiz added this to New in Triage via automation Oct 5, 2021
@jsuarezruiz jsuarezruiz moved this from New to Ready For Work in Triage Oct 5, 2021
@jsuarezruiz jsuarezruiz removed the s/unverified New report that has yet to be verified label Oct 5, 2021
@jsuarezruiz jsuarezruiz self-assigned this Oct 5, 2021
Triage automation moved this from Ready For Work to Closed Oct 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Triage
  
Closed
Development

Successfully merging a pull request may close this issue.

2 participants