My Xamarin.Forms app uses FFImageLoading for loading three Gifs.
(These Gifs created by DavinciResolve)
My app preload Gifs as following.
public static async void PreloadTutorialGifs()
{
try
{
var targetWidth = 500;
var targetHeight = 1000;
await ImageService.Instance.LoadFileFromApplicationBundle("A.gif").Success((info, result) =>
{
Debug.WriteLine($"A.gif Preloading finished! Key: {info.CacheKey}");
})
.CacheKey("A.gif")
.DownSample(targetWidth, targetHeight)
.PreloadAsync();
await ImageService.Instance.LoadFileFromApplicationBundle("B.gif").Success((info, result) =>
{
Debug.WriteLine($"B.gif Preloading finished! Key: {info.CacheKey}");
})
.CacheKey("B.gif")
.DownSample(targetWidth, targetHeight)
.PreloadAsync();
await ImageService.Instance.LoadFileFromApplicationBundle("C.gif").Success((info, result) =>
{
Debug.WriteLine($"C.gif Preloading finished! Key: {info.CacheKey}");
})
.CacheKey("C.gif")
.DownSample(targetWidth, targetHeight)
.PreloadAsync();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Utility.SendExceptionToCrashlytics(ex);
}
}
[simulator output]
2022-12-20 09:02:05.134347+0900 SoccerScoreApp.iOS[53533:1012657] FFImageLoading log: Image memory cache size: 3276.8 MB
2022-12-20 09:02:05.505321+0900 SoccerScoreApp.iOS[53533:1013047] FFImageLoading log: Generating/retrieving image: A.gif
A.gif Preloading finished! Key: A.gif
2022-12-20 09:02:14.867980+0900 SoccerScoreApp.iOS[53533:1013177] FFImageLoading log: Generating/retrieving image: B.gif
change_player_tutorial.gif Preloading finished! Key: B.gif
2022-12-20 09:02:23.464188+0900 SoccerScoreApp.iOS[53533:1013178] FFImageLoading log: Generating/retrieving image: C.gif
card_tutorial.gif Preloading finished! Key: C.gif
[real device output]
022-12-19 08:25:35.176 SoccerScoreApp.iOS[1020:52406] FFImageLoading log: Image memory cache size: 591.97 MB
022-12-19 08:25:35.850 SoccerScoreApp.iOS[1020:52464] FFImageLoading log: Generating/retrieving image: A.gif
=================================================================
Native Crash Reporting
=================================================================
Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
=================================================================
Native stacktrace:
=================================================================
0x10755ea58 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107554ba4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107562ed0 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x249b95c10 - /usr/lib/system/libsystem_platform.dylib : <redacted>
0x1da598340 - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da5a971c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da5a969c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da5a8f4c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3dc62c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3d800c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3e018c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da7cc7d4 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7eebf4 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da80e784 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7eebf4 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7c9550 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : CGAccessSessionCreate
0x1da790264 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7dda5c - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7abe9c - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7cb9e0 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da79d068 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : CGContextDrawImageWithOptions
0x1da3f6d5c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3e4318 - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3cf634 - /System/Library/Frameworks/ImageIO.framework/ImageIO : CGImageSourceCreateThumbnailAtIndex
0x103e6aac8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x10326f330 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106102c2c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106116918 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061775a4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x10610028c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106115030 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061772b4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1060fffbc - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106214990 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012d8480 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107566318 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x107620ae4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x10754b0cc - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012dd610 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100fe2cf4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061d2910 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x10621f8c4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012d8480 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107566318 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x107620ae4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x10754b0cc - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012dd610 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100fe2934 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061d35f8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1062271e4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1062e3f94 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061dde58 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x10623ab90 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1062ed5ec - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106224a5c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bd2ab8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bdeaf4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bded68 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100ba75ec - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100ba73ec - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100be5048 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bdec80 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bdeb58 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bb1348 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x103a2fd70 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bb3408 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012d8480 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107566318 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x1076223d0 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x107665634 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x107662ea8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x10766e63c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x10766e4c0 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x249b9d9ac - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
0x249b9ce68 - /usr/lib/system/libsystem_pthread.dylib : thread_start
=================================================================
Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x249b94a9c):0x249b94a8c 21 00 05 8b 20 04 40 ac 21 80 00 91 42 00 05 cb !... .@.!...B...
0x249b94a9c 02 0c 00 ac 42 00 01 f1 e9 00 00 54 60 04 00 ac ....B......T`...
0x249b94aac 63 80 00 91 20 04 40 ac 21 80 00 91 42 80 00 f1 c... .@.!...B...
0x249b94abc 68 ff ff 54 21 00 02 8b 22 0c 40 ac 60 04 00 ac h..T!...".@.`...
=================================================================
Managed Stacktrace:
=================================================================
at <unknown> <0xffffffff>
at ImageIO.CGImageSource:CGImageSourceCreateThumbnailAtIndex <0x00007>
at ImageIO.CGImageSource:CreateThumbnail <0x0006f>
at FFImageLoading.Decoders.GifDecoder:GetFrames <0x0012b>
at <SourceRegfToDecodedImageAsync>d__2:MoveNext <0x01407>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00173>
at FFImageLoading.Decoders.GifDecoder:SourceRegfToDecodedImageAsync <0x0026b>
at <DecodeAsync>d__1:MoveNext <0x0055f>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00173>
at FFImageLoading.Decoders.GifDecoder:DecodeAsync <0x0024b>
at <GenerateImageAsync>d__104:MoveNext <0x0030f>
at System.Object:runtime_invoke_dynamic <0x0010f>
at <unknown> <0xffffffff>
at System.Object:__icall_wrapper_mono_gsharedvt_constrained_call <0x00007>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00173>
at FFImageLoading.Work.ImageLoaderTask`3:GenerateImageAsync <0x002cf>
at <RunAsync>d__109:MoveNext <0x01ed3>
at System.Object:runtime_invoke_dynamic <0x0010f>
at <unknown> <0xffffffff>
at System.Object:__icall_wrapper_mono_gsharedvt_constrained_call <0x00007>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x00173>
at FFImageLoading.Work.ImageLoaderTask`3:RunAsync <0x00187>
at <RunImageLoadingTaskAsync>d__49:MoveNext <0x00993>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x00173>
at FFImageLoading.Work.WorkScheduler:RunImageLoadingTaskAsync <0x001a7>
at <<TakeFromPendingTasksAndRunAsync>b__3>d:MoveNext <0x000ff>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x0019b>
at <>c__DisplayClass48_0:<TakeFromPendingTasksAndRunAsync>b__3 <0x0016b>
at System.Threading.Tasks.Task`1:InnerInvoke <0x00057>
at System.Threading.Tasks.Task:Execute <0x00023>
at System.Threading.Tasks.Task:ExecutionContextCallback <0x00057>
at System.Threading.ExecutionContext:RunInternal <0x001ab>
at System.Threading.ExecutionContext:Run <0x0002b>
at System.Threading.Tasks.Task:ExecuteWithThreadLocal <0x00127>
at System.Threading.Tasks.Task:ExecuteEntry <0x0010f>
at System.Threading.Tasks.Task:System.Threading.IThreadPoolWorkItem.ExecuteWorkItem <0x00017>
at System.Threading.ThreadPoolWorkQueue:Dispatch <0x001e7>
at ObjCRuntime.Runtime:ThreadPoolDispatcher <0x0003f>
at System.Threading._ThreadPoolWaitCallback:PerformWaitCallback <0x00087>
at System.Object:runtime_invoke_dynamic <0x0010f>
=================================================================
[My FinishedLaunching method]
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
CachedImageRenderer.Init();
CachedImageRenderer.InitImageSourceHandler();
var config = new FFImageLoading.Config.Configuration()
{
VerboseLogging = true,
VerbosePerformanceLogging = true,
VerboseMemoryCacheLogging = true,
VerboseLoadingCancelledLogging = true,
Logger = new CustomLogger(),
MaxMemoryCacheSize = 20000000
};
ImageService.Instance.Initialize(config);
[CustomLogger]
public class CustomLogger : FFImageLoading.Helpers.IMiniLogger
{
public void Debug(string message)
{
Console.WriteLine($"FFImageLoading log: {message}");
}
public void Error(string errorMessage)
{
Console.WriteLine($"FFImageLoading error log: {errorMessage}");
}
public void Error(string errorMessage, Exception ex)
{
Error(errorMessage + System.Environment.NewLine + ex.ToString());
}
}
How can i fix this?
My Environment
Success Simulators
My Real Device
To fix, do EITHER:
var config = new FFImageLoading.Config.Configuration()
{
MaxMemoryCacheSize = 9999999, // Try different values here. Bigger uses more app memory.
};
ImageService.Instance.Initialize(config);