[MonoTouch] Weird Json.NET / Newtonsoft errors w/ latest MT beta and 5.1
Nic Wise
nicw at fastchicken.co.nz
Sat Mar 10 16:12:52 UTC 2012
I found that it appears to be doing things in a thread. eg, I was
sharing a sqlite connection between threads. Big problem in this
release (or possibly, in this release of sqlite in ios5.1 - not sure)
Same for the JSON stuff - move it into the main thread, no problems.
On Sat, Mar 10, 2012 at 15:39, Sebastien Pouliot <sebastien at xamarin.com> wrote:
> Hello Nic,
>
> It looks identical to bug #3676. You should add yourself on c.c. to
> the bug report.
>
> Sebastien
>
> [1] https://bugzilla.xamarin.com/show_bug.cgi?id=3676
>
> On Sat, Mar 10, 2012 at 6:21 AM, Nic Wise <nicw at fastchicken.co.nz> wrote:
>> I'm still not sure whats causing it, but I was deserializing a basic
>> json object within a thread, and today - and ONLY today - I've been
>> getting the stack dump below. If I do it outside of a thread, it works
>> _fine_.
>>
>> Anyone else seeing this?
>>
>> XC 4.3.1
>> iOS 5.1
>> MT latest beta (installed this morning)
>>
>> I tried going back to an old MT (5.2.5) with the same result. Once I
>> get this, if I restart my app, I get seg faults in all the codes....
>> mostly sqlite.
>>
>> Very odd.
>>
>>
>> --------------------------------
>>
>> 20120310/101453: Exception: System.NullReferenceException: Object
>> reference not set to an instance of an object
>> at System.Array.Copy (System.Array sourceArray, Int32 sourceIndex,
>> System.Array destinationArray, Int32 destinationIndex, Int32 length)
>> [0x00104] in /Developer/MonoTouch/Source/mono/mcs/cla
>> ss/corlib/System/Array.cs:979
>> at System.Collections.ArrayList.CopyTo (Int32 index, System.Array
>> array, Int32 arrayIndex, Int32 count) [0x0002d] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections/Arr
>> ayList.cs:3064
>> at System.Collections.ArrayList.CopyTo (System.Array array, Int32
>> arrayIndex) [0x00000] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections/ArrayList.cs:3046
>> at System.MonoCustomAttrs.GetCustomAttributes
>> (ICustomAttributeProvider obj, System.Type attributeType, Boolean
>> inherit) [0x0026c] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/Syste
>> m/MonoCustomAttrs.cs:259
>> at System.MonoType.GetCustomAttributes (System.Type attributeType,
>> Boolean inherit) [0x00011] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/MonoType.cs:582
>> at System.Attribute.GetCustomAttributes
>> (System.Reflection.MemberInfo element, System.Type type, Boolean
>> inherit) [0x00024] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Attri
>> bute.cs:229
>> at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttributes[JsonContainerAttribute]
>> (ICustomAttributeProvider attributeProvider, Boolean inherit)
>> [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttribute[JsonContainerAttribute]
>> (ICustomAttributeProvider attributeProvider, Boolean inherit)
>> [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[JsonContainerAttribute]
>> (ICustomAttributeProvider attributeProvider) [0x00000] in <filename
>> unknown>:0
>> at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Reflection.ICustomAttributeProvider,Newtonsoft.Json.JsonContainerAttribute].AddValue
>> (ICustomAttributeProvider key) [0x00000] in <filen
>> ame unknown>:0
>> at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Reflection.ICustomAttributeProvider,Newtonsoft.Json.JsonContainerAttribute].Get
>> (ICustomAttributeProvider key) [0x00000] in <filename u
>> nknown>:0
>> at Newtonsoft.Json.Serialization.CachedAttributeGetter`1[Newtonsoft.Json.JsonContainerAttribute].GetAttribute
>> (ICustomAttributeProvider type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonContainerAttribute
>> (System.Type type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonObjectAttribute
>> (System.Type type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract
>> (System.Type objectType) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Type,Newtonsoft.Json.Serialization.JsonContract].AddValue
>> (System.Type key) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Type,Newtonsoft.Json.Serialization.JsonContract].Get
>> (System.Type key) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract
>> (System.Type type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.GetContractSafe
>> (System.Type type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType
>> (Newtonsoft.Json.JsonReader reader, System.Type t,
>> Newtonsoft.Json.JsonConverter propertyConverter) [0x00000] in <f
>> ilename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize
>> (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000]
>> in <filename unknown>:0
>> at Newtonsoft.Json.JsonSerializer.DeserializeInternal
>> (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000]
>> in <filename unknown>:0
>> at Newtonsoft.Json.JsonSerializer.Deserialize
>> (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000]
>> in <filename unknown>:0
>> at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String
>> value, System.Type type, Newtonsoft.Json.JsonSerializerSettings
>> settings) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.JsonConvert.DeserializeObject[Settings]
>> (System.String value, Newtonsoft.Json.JsonSerializerSettings settings)
>> [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.JsonConvert.DeserializeObject[Settings]
>> (System.String value) [0x00000] in <filename unknown>:0
>> at MicroAgent.Library.Models.Settings.get_Current () [0x00036] in
>> /Users/nic/code/git/MicroAgent/MicroAgentLibrary/Models/Settings.cs:118
>> at MicroAgent.Library.OverviewDialogViewController.LoadView ()
>> [0x000b6] in /Users/nic/code/git/MicroAgent/MicroAgentLibrary/Controllers/OverviewDialogViewController.cs:75
>> at (wrapper managed-to-native)
>> MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr)
>> at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x0000b] in
>> /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:105
>> at MicroAgent.AppDelegate.FinishedLaunching
>> (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary
>> options) [0x0020b] in
>> /Users/nic/code/git/MicroAgent/MicroAgent/AppDelegate
>> .cs:140
>> at (wrapper managed-to-native)
>> MonoTouch.UIKit.UIApplication:UIApplicationMain
>> (int,string[],intptr,intptr)
>> at MonoTouch.UIKit.UIApplication.Main (System.String[] args,
>> System.String principalClassName, System.String delegateClassName)
>> [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/
>> UIApplication.cs:29
>> at MicroAgent.Application.Main (System.String[] args) [0x0000b] in
>> /Users/nic/code/git/MicroAgent/MicroAgent/Main.cs:22
>>
>> --------------- AND ----------------------
>>
>> 20120310/101453: StackTrace: at System.Array.Copy (System.Array
>> sourceArray, Int32 sourceIndex, System.Array destinationArray, Int32
>> destinationIndex, Int32 length) [0x00104] in /Developer/
>> MonoTouch/Source/mono/mcs/class/corlib/System/Array.cs:979
>> at System.Collections.ArrayList.CopyTo (Int32 index, System.Array
>> array, Int32 arrayIndex, Int32 count) [0x0002d] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections/Arr
>> ayList.cs:3064
>> at System.Collections.ArrayList.CopyTo (System.Array array, Int32
>> arrayIndex) [0x00000] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections/ArrayList.cs:3046
>> at System.MonoCustomAttrs.GetCustomAttributes
>> (ICustomAttributeProvider obj, System.Type attributeType, Boolean
>> inherit) [0x0026c] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/Syste
>> m/MonoCustomAttrs.cs:259
>> at System.MonoType.GetCustomAttributes (System.Type attributeType,
>> Boolean inherit) [0x00011] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/MonoType.cs:582
>> at System.Attribute.GetCustomAttributes
>> (System.Reflection.MemberInfo element, System.Type type, Boolean
>> inherit) [0x00024] in
>> /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Attri
>> bute.cs:229
>> at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttributes[JsonContainerAttribute]
>> (ICustomAttributeProvider attributeProvider, Boolean inherit)
>> [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttribute[JsonContainerAttribute]
>> (ICustomAttributeProvider attributeProvider, Boolean inherit)
>> [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[JsonContainerAttribute]
>> (ICustomAttributeProvider attributeProvider) [0x00000] in <filename
>> unknown>:0
>> at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Reflection.ICustomAttributeProvider,Newtonsoft.Json.JsonContainerAttribute].AddValue
>> (ICustomAttributeProvider key) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Reflection.ICustomAttributeProvider,Newtonsoft.Json.JsonContainerAttribute].Get
>> (ICustomAttributeProvider key) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.CachedAttributeGetter`1[Newtonsoft.Json.JsonContainerAttribute].GetAttribute
>> (ICustomAttributeProvider type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonContainerAttribute
>> (System.Type type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonObjectAttribute
>> (System.Type type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract
>> (System.Type objectType) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Type,Newtonsoft.Json.Serialization.JsonContract].AddValue
>> (System.Type key) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Type,Newtonsoft.Json.Serialization.JsonContract].Get
>> (System.Type key) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract
>> (System.Type type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.GetContractSafe
>> (System.Type type) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType
>> (Newtonsoft.Json.JsonReader reader, System.Type t,
>> Newtonsoft.Json.JsonConverter propertyConverter) [0x00000] in
>> <filename unknown>:0
>> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize
>> (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000]
>> in <filename unknown>:0
>> at Newtonsoft.Json.JsonSerializer.DeserializeInternal
>> (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000]
>> in <filename unknown>:0
>> at Newtonsoft.Json.JsonSerializer.Deserialize
>> (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000]
>> in <filename unknown>:0
>> at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String
>> value, System.Type type, Newtonsoft.Json.JsonSerializerSettings
>> settings) [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.JsonConvert.DeserializeObject[Settings]
>> (System.String value, Newtonsoft.Json.JsonSerializerSettings settings)
>> [0x00000] in <filename unknown>:0
>> at Newtonsoft.Json.JsonConvert.DeserializeObject[Settings]
>> (System.String value) [0x00000] in <filename unknown>:0
>> at MicroAgent.Library.Models.Settings.get_Current () [0x00036] in
>> /Users/nic/code/git/MicroAgent/MicroAgentLibrary/Models/Settings.cs:118
>> at MicroAgent.Library.OverviewDialogViewController.LoadView ()
>> [0x000b6] in /Users/nic/code/git/MicroAgent/MicroAgentLibrary/Controllers/OverviewDialogViewController.cs:75
>> at (wrapper managed-to-native)
>> MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr)
>> at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x0000b] in
>> /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:105
>> at MicroAgent.AppDelegate.FinishedLaunching
>> (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary
>> options) [0x0020b] in
>> /Users/nic/code/git/MicroAgent/MicroAgent/AppDelegate.cs:140
>> at (wrapper managed-to-native)
>> MonoTouch.UIKit.UIApplication:UIApplicationMain
>> (int,string[],intptr,intptr)
>> at MonoTouch.UIKit.UIApplication.Main (System.String[] args,
>> System.String principalClassName, System.String delegateClassName)
>> [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
>> at MicroAgent.Application.Main (System.String[] args) [0x0000b] in
>> /Users/nic/code/git/MicroAgent/MicroAgent/Main.cs:22
>>
>> --
>> Nic Wise
>> t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
>> b. http://www.fastchicken.co.nz/
>>
>> Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
>> mobileAgent (for FreeAgent): get your accounts in your pocket.
>> http://goo.gl/IuBU
>> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
>> London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
>> _______________________________________________
>> MonoTouch mailing list
>> MonoTouch at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/monotouch
--
Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
More information about the MonoTouch
mailing list