Bug 5519 - XElement.ToString() adding p1 prefix
Summary: XElement.ToString() adding p1 prefix
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.2.x
Hardware: PC Windows
: High major
Target Milestone: ---
Assignee: Atsushi Eno
Depends on:
Reported: 2012-06-05 12:01 UTC by kenneth.beasley
Modified: 2012-06-07 00:08 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description kenneth.beasley 2012-06-05 12:01:02 UTC
Component: Sys.XML

OS: Android 2.3


XElement.ToString will display a default prefix of p1 if there is no other prefix assigned.


The application I'm running serializes isolated XElements to a string to be streamed over the network (since it uses XMPP to communicate).  Because of this, classes derived from XElement, need to be serialized into a string and sent over, sometimes without any prefix attached to an element name.

With the latest version of Mono For Android (this behavior was not present in earlier versions), a prefix of p1 is added to the string.

Steps to Reproduce:

            XNamespace ns = "http://jabber.org/protocol/geoloc";
            XElement newElement = new XElement(ns + "geoloc");

            Android.Util.Log.Debug("XElementTest", newElement.ToString());

Actual Output: 
<p1:geoloc xmlns:p1="http://jabber.org/protocol/geoloc" />

Expected Output (on Windows):
<geoloc xmlns="http://jabber.org/protocol/geoloc" />

Additional Builds and Platforms:
This issue did not appear on version 4.2 (seems to have been introduced in 4.2.2)
Comment 1 Atsushi Eno 2012-06-07 00:08:44 UTC
Fixed in mono master and mono-2-10. Thanks for the report.