Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Akavache, Json and iOS throwing TypeLoadExceptions

$
0
0

Hey Guys,

I just installed the Akavache plugin into my Xamarin Forms project. With android everything runs just fine but on iOS I get the following error:

Unhandled Exception:

System.TypeLoadException: Could not load type Xamarin.Forms.Platform._LabelRenderer, Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null while decoding custom attribute

2015-07-24 12:38:25.671 KinsmenAppiOS[5643:1069728] Unhandled managed exception:
Could not load type Xamarin.Forms.Platform._LabelRenderer, Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null while decoding custom attribute (System.TypeLoadException)
  at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType, Boolean inheritedOnly) [0x00019] in /Users/builder/data/lanes/1926/6916d0e3/source/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:103 
  at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00344] in /Users/builder/data/lanes/1926/6916d0e3/source/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:263 
  at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, Boolean inherit) [0x0002a] in /Users/bui
lder/data/lanes/1926/6916d0e3/source/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:286 
  at System.MonoType.GetCustomAttributes (Boolean inherit) [0x00000] in /Users/builder/data/lanes/1926/6916d0e3/source/mono/mcs/class/corlib/System/MonoType.cs:609 
  at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttributes (System.Object attributeProvider, System.Type attributeType, Boolean inherit) [0x0001f] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAssociateMetadataTypeFromAttribute (System.Type type) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Type,System.Type].AddValue (System.Type key) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Type,System.Type].Get (System.Type key) [0x00010] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAssociatedMetadataType (System.Type type) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonTypeReflect
or.GetAttribute[JsonContainerAttribute] (System.Type type) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[JsonContainerAttribute] (System.Object provider) [0x0000a] in <filename unknown>:0 
  at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Object,Newtonsoft.Json.JsonContainerAttribute].AddValue (System.Object key) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Object,Newtonsoft.Json.JsonContainerAttribute].Get (System.Object key) [0x00010] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.CachedAttributeGetter`1[Newtonsoft.Json.JsonContainerAttribute].GetAttribute (System.Object type) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonTypeReflector.GetCachedAttribute[JsonContainerAttribute] (System.Object attributeProvider) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x00017] in <filen
ame unknown>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) [0x00038] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContainerContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract& memberContract, System.Object& memberValue) [0x00053] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x0003c] in <filename unknown>:0 
--- End of stack trace from p
revious location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/1926/6916d0e3/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61 
  at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow (System.Exception exception) [0x00006] in <filename unknown>:0 
  at System.Reactive.ExceptionHelpers.ThrowIfNotNull (System.Exception exception) [0x0000d] in <filename unknown>:0 
  at System.Reactive.Subjects.AsyncSubject`1[System.Collections.Generic.List`1[KinsmenApp.Models.KinsmanStatusModel]].GetResult () [0x00039] in <filename unknown>:0 
  at KinsmenApp.ViewModels.KinsmanPageViewModel+<InitStatusHistoryEntries>d__6.MoveNext () [0x000ee] in c:\Users\Arbeit\git\HnrKinsmen\KinsmenApp\ViewModels\KinsmanPageViewModel.cs:119 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Us
ers/builder/data/lanes/1926/6916d0e3/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in /Users/builder/data/lanes/1926/6916d0e3/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1006 
  at UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/1926/6916d0e3/source/maccore/src/UIKit/UIKitSynchronizationContext.cs:24 
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/1926/6916d0e3/source/maccore/src/Foundation/NSAction.cs:164 
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/1926/6916d0e3/source/maccore/src/UIKit/UIApplication.cs:63 
  at UIKit.UIApplic
ation.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Users/builder/data/lanes/1926/6916d0e3/source/maccore/src/UIKit/UIApplication.cs:46 
  at KinsmenApp.iOS.Application.Main (System.String[] args) [0x00001] in c:\Users\Arbeit\git\HnrKinsmen\iOS\Main.cs:16 

Debugging (iPhone 6) brought me to the following lines where the app is supposed to parse the json to objects (which is why I suspect some versioning issues with Newtonsoft.Json and Akavache):

               if (result.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var responseText = result.Content.ReadAsStringAsync().Result;
                    var response = JsonConvert.DeserializeAnonymousType(responseText, definition);

                    return response;
                }

The exception pops up when I use JsonConvert.DeserializeAnonymousType(...)

Did anyone stumble upon this issue as well? Or knows what I could do to fix it?

Thank you in advance!


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>