I am getting a random null reference exception (this only happens about 50%
of the time) when invoking the following line of code:

XmlSerializer sr = new XmlSerializer (typeof(List<FeedItem>));

The only thing I can think of is that this issue is related to the threading
issues which were fixed in one of the recent versions of MonoTouch, since
this was working fine before the update. Also, if I understand it correctly
this code would be invoked on a separate thread since it is a WebRequest
async callback.

You can see the callstack below:

System.Array.Copy (sourceArray={object[4]}, sourceIndex=0,
destinationArray={System.Xml.Serialization.XmlIncludeAttribute[0]},
destinationIndex=0, length=0) in
/Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Array.cs:979
System.Collections.ArrayList.CopyTo (index=0,
array={System.Xml.Serialization.XmlIncludeAttribute[0]}, arrayIndex=0,
count=0) in
/Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections/ArrayList.cs:3064
System.Collections.ArrayList.CopyTo
(array={System.Xml.Serialization.XmlIncludeAttribute[0]}, arrayIndex=0) in
/Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections/ArrayList.cs:3046
System.MonoCustomAttrs.GetCustomAttributes (obj={System.Object},
attributeType={System.Xml.Serialization.XmlIncludeAttribute}, inherit=false)
in
/Developer/MonoTouch/Source/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:259
System.MonoType.GetCustomAttributes
(attributeType={System.Xml.Serialization.XmlIncludeAttribute},
inherit=false) in
/Developer/MonoTouch/Source/mono/mcs/class/corlib/System/MonoType.cs:582
System.Xml.Serialization.XmlReflectionImporter.ImportIncludedTypes
(type={System.Object}, defaultNamespace="") in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:663
System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping
(typeData={System.Xml.Serialization.TypeData}, root=(null),
defaultNamespace="") in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:393
System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping
(type={System.Object}, root=(null), defaultNamespace="") in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:321
System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping
(typeData={System.Xml.Serialization.TypeData}, root=(null),
defaultNamespace="") in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:376
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping
(typeData={System.Xml.Serialization.TypeData}, root=(null),
defaultNamespace="") in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:217
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping
(type={######Dashboard.FeedItem}, root=(null), defaultNamespace="") in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:192
System.Xml.Serialization.XmlReflectionImporter.ImportListMapping
(typeData={System.Xml.Serialization.TypeData}, root=(null),
defaultNamespace="", atts={System.Xml.Serialization.XmlAttributes},
nestingLevel=0) in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:518
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping
(typeData={System.Xml.Serialization.TypeData}, root=(null),
defaultNamespace="") in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:218
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping
(type={System.Collections.Generic.List`1[######Dashboard.FeedItem]},
root=(null), defaultNamespace="") in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:192
System.Xml.Serialization.XmlSerializer..ctor
(type={System.Collections.Generic.List`1[######Dashboard.FeedItem]},
overrides=(null), extraTypes=(null), root=(null), defaultNamespace=(null))
in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:227
System.Xml.Serialization.XmlSerializer..ctor
(type={System.Collections.Generic.List`1[######Dashboard.FeedItem]}) in
/Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs
######Dashboard.RSSRepository.GetFeedResponseFinished
(result={System.Net.WebAsyncResult}) in
/Users/######/Dropbox/Work/######/Clients/######/######Dashboard/######Dashboard/Framework/RSS/RSSRepository.cs:154
System.Net.WebAsyncResult.CB (unused=(null)) in
/Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebAsyncResult.cs:148

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/XmlSerializer-constructor-exception-Null-Reference-tp3779966p3779966.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to