[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
			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)
at System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)

Is there something wrong with my code? Or is there a bug in mono?


More information about the Mono-list mailing list