reactiveui / splat

Makes things cross-platform
MIT License
969 stars 142 forks source link

PlatformBitmapLoader static ctor throwing exception on Android #137

Closed 1Cor125 closed 8 years ago

1Cor125 commented 8 years ago

I'm getting this exception only on Android. iOS and UWP are fine.

android.runtime.JavaProxyThrowable: System.TypeInitializationException: The type initializer for 'Splat.PlatformBitmapLoader' threw an exception. ---> System.InvalidOperationException: Sequence contains no matching element

Splat has been added to each assembly via nuget. Have searched posted issues. Feels like I am missing something obvious here.

flagbug commented 8 years ago

Do you have a full StackTrace?

1Cor125 commented 8 years ago
---- 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 Watchtower.JWLibrary.Services.Meps.Images.ImageProviderService+<GetImageAsync>c__async0.MoveNext () <0x9310a8e0 + 0x0061f> in <filename unknown>:0 
        --- End of stack trace from previous location where exception was thrown ---
          at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x94687160 + 0x0002b> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x934ffed8 + 0x000b3> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x934eff38 + 0x0007f> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x956b7468 + 0x00033> in <filename unknown>:0 
          at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () <0x956b73f8 + 0x00017> in <filename unknown>:0 
          at Watchtower.JWLibrary.Tests.Shared.Services.Meps.Images.ImageProviderServiceTests+<GetImageAsyncTakingPubKeyReturnsCorrectBitmapAsync>c__async3.MoveNext () <0x9310b6f8 + 0x0091f> in <filename unknown>:0 
        --- End of stack trace from previous location where exception was thrown ---
          at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x94687160 + 0x0002b> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x934ffed8 + 0x000b3> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x934eff38 + 0x0007f> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x956b7468 + 0x00033> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x94e739f8 + 0x00013> in <filename unknown>:0 
        --- End of stack trace from previous location where exception was thrown ---
          at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x94687160 + 0x0002b> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x934ffed8 + 0x000b3> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x934eff38 + 0x0007f> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x956b7468 + 0x00033> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x94e739f8 + 0x00013> in <filename unknown>:0 
        --- End of stack trace from previous location where exception was thrown ---
          at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x94687160 + 0x0002b> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x934ffed8 + 0x000b3> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x934eff38 + 0x0007f> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x956b7468 + 0x00033> in <filename unknown>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x94e739f8 + 0x00013> in <filename unknown>:0 
        ----- Inner Stack Trace -----
          at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) <0x9638a460 + 0x0007f> in <filename unknown>:0 
          at System.RuntimeType.CreateInstanceMono (Boolean nonPublic) <0x95e72130 + 0x00137> in <filename unknown>:0 
          at System.RuntimeType.CreateInstanceSlow (Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, System.Threading.StackCrawlMark& stackMark) <0x95e720d8 + 0x00043> in <filename unknown>:0 
          at System.RuntimeType.CreateInstanceDefaultCtor (Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, System.Threading.StackCrawlMark& stackMark) <0x95e72058 + 0x00047> in <filename unknown>:0 
          at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) <0x95e71f48 + 0x00093> in <filename unknown>:0 
          at System.Activator.CreateInstance (System.Type type) <0x95a8edb0 + 0x0001b> in <filename unknown>:0 
          at Splat.AssemblyFinder.AttemptToLoadType[T] (System.String fullTypeName) <0x9310d628 + 0x0022f> in <filename unknown>:0 
          at Splat.BitmapLoader..cctor () <0x9310d5e8 + 0x00017> in <filename unknown>:0 
        ----- Inner 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) <0x9638a460 + 0x00033> in <filename unknown>:0 
        ----- Inner Stack Trace -----
          at System.Linq.Enumerable.First[TSource] (IEnumerable`1 source, System.Func`2 predicate) <0x95e59800 + 0x000eb> in <filename unknown>:0 
          at Splat.PlatformBitmapLoader..cctor () <0x9310d9d0 + 0x000c7> in <filename unknown>:0 
flagbug commented 8 years ago

Are you sure you've added Splat to your Android test project?

1Cor125 commented 8 years ago

Yeah. I even removed and added it back to be sure. Also linking is turned off.

1Cor125 commented 8 years ago

Our test runner was not using any resources and the Resources.designer.cs was removed from the project at some point. So of course this line is where Splat choked:

var resources = assm.GetModules().SelectMany(x => x.GetTypes()).First(x => x.Name == "Resource");

Added Resources.designer.cs back and everything is fine.

facepalm