Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Windows Phone Mango - Invalid cross-thread access? parsing XML
    primarykey
    data
    text
    <p>I have the following code which seems to throw a "Invalid cross-thread access." and I can't seem to figure out why. I'm loading a remote xml file from a URL, however, when parsing that XML I always receive this error. Any suggestions?</p> <pre><code>using (StreamReader streamReader = new StreamReader(response.GetResponseStream())) { string xml = streamReader.ReadToEnd(); using (XmlReader reader = XmlReader.Create(new StringReader(xml))) { reader.ReadToFollowing("channel"); reader.MoveToFirstAttribute(); reader.ReadToFollowing("title"); output.AppendLine("Title: " + reader.ReadElementContentAsString()); reader.ReadToFollowing("description"); output.AppendLine("Desc: " + reader.ReadElementContentAsString()); textBox1.Text = output.ToString(); //Invalid cross-thread access. } } </code></pre> <p>The XML I'm trying to parse looks like the following, I'm just trying to parse bits and pieces as I continue to learn how to use c# to parse different types of XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"xmlns:dc="http://purl.org /dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0 /modules/slash/"&gt; &lt;channel&gt; &lt;title&gt;Server &amp;amp; Site News&lt;/title&gt; &lt;description&gt;A place for the Admin and Moderators to post the latest news on both the server and site.&lt;/description&gt; &lt;pubDate&gt;Fri, 18 May 2012 22:45:08 +0000&lt;/pubDate&gt; &lt;lastBuildDate&gt;Fri, 18 May 2012 22:45:08 +0000&lt;/lastBuildDate&gt; &lt;generator&gt;Forums&lt;/generator&gt; &lt;link&gt;http://removedurl.com/forums/server-site-news.23/&lt;/link&gt; &lt;atom:link rel="self" type="application/rss+xml" href="http://removedurl.com/forums/server-site-news.23/index.rss"/&gt; &lt;item&gt; &lt;title&gt;Example Title&lt;/title&gt; &lt;pubDate&gt;Mon, 14 May 2012 17:39:45 +0000&lt;/pubDate&gt; &lt;link&gt;http://removedurl.com/threads/back-fully-working.11013/&lt;/link&gt; &lt;guid&gt;http://removedurl.com/threadsback-fully-working.11013/&lt;/guid&gt; &lt;author&gt;Admin&lt;/author&gt; &lt;dc:creator&gt;Admin&lt;/dc:creator&gt; &lt;slash:comments&gt;14&lt;/slash:comments&gt; &lt;/item&gt; &lt;/channel&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload