NAXAM / mapbox-xamarin-forms

Mapbox on Xamarin.Forms
Apache License 2.0
73 stars 41 forks source link

Android: app freeze + fix #106

Open softlion opened 3 years ago

softlion commented 3 years ago

Please replace this incorrect code which triggers app freeze when real async image sources are used (like SvgImageSource from https://github.com/softlion/XamSvg-Samples).

Replace in https://github.com/NAXAM/mapbox-xamarin-forms/blob/master/Naxam.Mapbox.Platform.Droid/Extensions/ImageSourceExtensions.cs

            return handler?
                .LoadImageAsync(source, context).Result;

With this correct code:

            return handler?
                .LoadImageAsync(source, context).GetAwaiter().GetResult();

Or better: make this method async.