[Mono-list] NullReferenceException on XDocument.Load
David Grant
davidgrant at gmail.com
Wed Oct 21 11:04:02 EDT 2009
Hi all,
The following code throws a NullReferenceException in XDocument.Load
Uri youTubeUrl = new
Uri("http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed");
WebClient wc = new WebClient();
XmlTextReader xr = new XmlTextReader(wc.OpenRead(youTubeUrl));
XDocument xdoc = XDocument.Load(xr);
System.NullReferenceException : Object reference not set to an
instance of an object
at System.Xml.Linq.XDocument.Load (System.Xml.XmlReader reader,
LoadOptions options) [0x00000]
at System.Xml.Linq.XDocument.Load (System.Xml.XmlReader reader) [0x00000]
at Tests.InnerTubeServiceTest.TestCase () [0x00000]
at (wrapper managed-to-native)
System.Reflection.MonoMethod:InternalInvoke
(object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00000]
Is there something wrong with my code? Or is there a bug in mono?
Thanks,
Dave
More information about the Mono-list
mailing list