splat: [BUG] System.Reflection.TargetInvocationException on BitmapLoader.Current

Describe the bug I am using akavache and LoadImageFromUrl(key,url,fetchalways,…) method. As I can see this calls the BitmapLoader.Current.Load() method this throws an exception. Possible the Reflection of the PlatformBitmapLoader fails when BitmapLoader.Current is called

Expected behavior An image is loaded 😁

Environment(please complete the following information):

  • OS: Android (iOS is fine)
  • Akavache: 5.0.0 (can’t use any other right now)
  • Splat: 3.0.0 (can’t use any other right now)

Additional context

{
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.-- - > System.TypeInitializationException: The type initializer
    for 'Splat.PlatformBitmapLoader'
    threw an exception.-- - > System.InvalidOperationException: Sequence contains no matching element
    at System.Linq.Enumerable.First[TSource](System.Collections.Generic.IEnumerable `1[T] source, System.Func`
        2[T, TResult] predicate)[0x00011] in < ba85ba5122c3499483c4d8a7ac6f7e5a >: 0
    at Splat.PlatformBitmapLoader..cctor()[0x00026] in < b69f18e916c449f19b169602282b9d0f >: 0
        -- - End of inner exception stack trace-- -
        at(wrapper managed - to - native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod, object, object[], System.Exception & )
    at System.Reflection.MonoCMethod.InternalInvoke(System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions)[0x00005] in < 58604 b4522f748968296166e317b04b4 >: 0
        -- - End of inner exception stack trace-- -
        at System.Reflection.MonoCMethod.InternalInvoke(System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions)[0x0001a] in < 58604 b4522f748968296166e317b04b4 >: 0
    at System.RuntimeType.CreateInstanceMono(System.Boolean nonPublic, System.Boolean wrapExceptions)[0x000a8] in < 58604 b4522f748968296166e317b04b4 >: 0
    at System.RuntimeType.CreateInstanceSlow(System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark & stackMark)[0x00009] in < 58604 b4522f748968296166e317b04b4 >: 0
    at System.RuntimeType.CreateInstanceDefaultCtor(System.Boolean publicOnly, System.Booean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark & stackMark)[0x00027] in < 58604 b4522f748968296166e317b04b4 >: 0
    at System.Activator.CreateInstance(System.Type type, System.Boolean nonPublic, System.Boolean wrapExceptions)[0x0002c] in < 58604 b4522f748968296166e317b04b4 >: 0
    at System.Activator.CreateInstance(System.Type type, System.Boolean nonPublic)[0x00000] in < 58604 b4522f748968296166e317b04b4 >: 0
    at System.Activator.CreateInstance(System.Type type)[0x00000] in < 58604 b4522f748968296166e317b04b4 >: 0
    at Splat.AssemblyFinder.AttemptToLoadType[T](System.String fullTypeName)[0x000bb] in < b69f18e916c449f19b169602282b9d0f >: 0
    at Splat.BitmapLoader..cctor()[0x00000] in < b69f18e916c449f19b169602282b9d0f >: 0
}


{
    System.TypeInitializationException: The type initializer
    for 'Splat.PlatformBitmapLoader'
    threw an exception.-- - > System.InvalidOperationException: Sequence contains no matching element
    at System.Linq.Enumerable.First[TSource](System.Collections.Generic.IEnumerable `1[T] source, System.Func`
        2[T, TResult] predicate)[0x00011] in < ba85ba5122c3499483c4d8a7ac6f7e5a >: 0
    at Splat.PlatformBitmapLoader..cctor()[0x00026] in < b69f18e916c449f19b169602282b9d0f >: 0
        -- - End of inner exception stack trace-- -
        at(wrapper managed - to - native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod, object, object[], System.Exception & )
    at System.Reflection.MonoCMethod.InternalInvoke(System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions)[0x00005] in < 58604 b4522f748968296166e317b04b4 >: 0
}


{
    System.InvalidOperationException: Sequence contains no matching element
    at System.Linq.Enumerable.First[TSource](System.Collections.Generic.IEnumerable `1[T] source, System.Func`
        2[T, TResult] predicate)[0x00011] in < ba85ba5122c3499483c4d8a7ac6f7e5a >: 0
    at Splat.PlatformBitmapLoader..cctor()[0x00026] in < b69f18e916c449f19b169602282b9d0f >: 0
}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (16 by maintainers)

Commits related to this issue

Most upvoted comments

I will see how far away @dpvreony is coming from the fix. That is a fairly standard reply if people start requesting changes immediately and stuff. There is definitely a problem where sometimes clients of open source products tend to expect guaranteed support levels and stuff so no offense intended and none taken.

I will have a look at it tomorrow my time for you. See what I can find.