Error: NotSupportedException

Mar 4, 2011 at 5:36 PM
Edited Mar 4, 2011 at 11:35 PM

Hi, I downloaded the file and when I run the code in debug mode, I get the following error:

This error happens from time to time and appears to be random.  It has happened both on a wired and wireless connection. 

Sadly, I have tried to repro the error and cannot get it to repro.  But then it reappears.  Not sure what the circumstance that causes the error to happen.

The code is correct, so it might be a connection problem.  I have had the error on two differently configured machines.  One is using Win 7 64 bit Enterprise and the other is running Win 7 64 bit Professional.

 

System.NotSupportedException was unhandled
  Message=NotSupportedException
  StackTrace:
       at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlTextReaderImpl.Read()
       at System.Xml.XmlReader.MoveToContent()
       at System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options)
       at System.Xml.Linq.XElement.Load(Stream stream, LoadOptions options)
       at System.Xml.Linq.XElement.Load(Stream stream)
       at WeatherForecast.HandlerForecastResponse(IAsyncResult asyncResult)
       at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.<InvokeGetResponseCallback>b__8(Object state2)
       at System.Threading.ThreadPool.WorkItem.doWork(Object o)
       at System.Threading.Timer.ring()

 

It occurs at this code point in the WeatherForcast.cs

 

 

 

 

 

 

 

 

 

 

 

XElement xmlWeather = default(XElement

XElement

.Load(streamResult

 

 

);

 

 

 

 

 

 

 

 

 

// load the XML

 

 

 

{

 

 

 

 

try

); xmlWeather =

 

 

 

 

 

streamResult = forecastState.AsyncResponse.GetResponseStream();

 

 

 

 

 

// get the stream containing the response from the async call

 

Mar 5, 2011 at 9:38 PM

I have been running into the same problem, but only sometimes. I'm not sure what causes it.