[Mono-bugs] [Bug 501589] New: XElement Seems to Break

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu May 7 00:13:25 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=501589


           Summary: XElement Seems to Break
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86-64
        OS/Version: openSUSE 11.1
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: michael.koby at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User


I have run the following code on both Mono (through MonoDevelop) and the .NET
Framework (through Visual Studio 2008).  On Mono, I receive the following
error.

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
  at System.Xml.Linq.XElement.Load (System.Xml.XmlReader reader, LoadOptions
options) [0x00000] 
  at System.Xml.Linq.XElement.Load (System.Xml.XmlReader reader) [0x00000] 
  at XElement_Test.MainClass.Main (System.String[] args) [0x00010] in
/home/mkoby/Projects/XElement_Test/XElement_Test/Main.cs:20 

The .NET Framework will print the expected XML Element to the screen.

---------------------------------BEGIN
CODE-------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Net;
using System.Text;
using System.Xml;
using System.Xml.Linq;


namespace XElement_Test
{
    class MainClass
    {

        public static void Main(string[] args)
        {
            XmlReader myReader = new XmlTextReader(new StringReader(xmlText));
            //XmlTextReader myReader = new XmlTextReader(new
StringReader(xmlText));
            XElement singleStatus = XElement.Load(myReader);

            Console.WriteLine(singleStatus.Element("user").ToString());
            Console.ReadLine();
        }


        private static string xmlText = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><status>  " + 
            "<created_at>Wed May 06 22:20:53 +0000 2009</created_at> 
<id>1721215247</id>  " + 
                "<text>@migueldeicaza I can gladly file a bug when I sit down
at my home pc again, " + 
                "probably tomorrow.</text>  <source>&lt;a
href=\"http://www.atebits.com/\"&gt;Tweetie&lt;/a&gt;</source>  " + 
                "<truncated>false</truncated> 
<in_reply_to_status_id>1721174205</in_reply_to_status_id>  " + 
                "<in_reply_to_user_id>823083</in_reply_to_user_id> 
<favorited>false</favorited>  " + 
               
"<in_reply_to_screen_name>migueldeicaza</in_reply_to_screen_name>  " + 
                "<user>    <id>7263572</id>    <name>Michael Koby</name>   
<screen_name>mkoby</screen_name>    " + 
                "<location>Katy, TX</location>    <description>Technology
Enthusiast, Blogger, and IT Consultant for Sogeti USA in Houston,
TX</description>    " + 
               
"<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/82700855/me_normal.jpg</profile_image_url>
   " + 
                "<url>http://www.mkoby.com</url>   
<protected>false</protected>    <followers_count>205</followers_count>    " + 
                "<profile_background_color>9AE4E8</profile_background_color>   
<profile_text_color>333333</profile_text_color>    " + 
                "<profile_link_color>0084B4</profile_link_color>   
<profile_sidebar_fill_color>DDFFCC</profile_sidebar_fill_color>    " + 
               
"<profile_sidebar_border_color>BDDCAD</profile_sidebar_border_color>   
<friends_count>106</friends_count>    " + 
                "<created_at>Thu Jul 05 06:51:53 +0000 2007</created_at>   
<favourites_count>24</favourites_count>    " + 
                "<utc_offset>-21600</utc_offset>    <time_zone>Central Time (US
&amp; Canada)</time_zone>    " + 
               
"<profile_background_image_url>http://s3.amazonaws.com/twitter_production/profile_background_images/3399427/twiterbackground.jpg</profile_background_image_url>
   " + 
                "<profile_background_tile>false</profile_background_tile>   
<statuses_count>4027</statuses_count>    " + 
                "<notifications></notifications>    <following></following> 
</user></status>";
    }
}
---------------------------------END CODE-------------------------------------

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list