Bug 29935

Summary: XAttribute.ToString() outputs wrong result if attribute contains namespace
Product: [Mono] Class Libraries Reporter: eb1
Component: System.XMLAssignee: Bugzilla <bugzilla>
Severity: normal CC: abhishekk, alex.koeplinger, masafa, mono-bugs+mono
Priority: ---    
Version: 4.0.0   
Target Milestone: Untriaged   
Hardware: PC   
OS: All   
Tags: Is this bug a regression?: ---
Last known good build:

Description eb1 2015-05-11 08:51:08 UTC
The following code snippet produces a wrong result:

	const string xml ="<?xml version='1.0' encoding='utf-8'?><lift xmlns:test='http://test.example.com'></lift>";
	var fileName = Path.GetTempFileName();
	File.WriteAllText(fileName, xml);
	var doc = XDocument.Load(fileName);
	Console.WriteLine(doc.Root.Attributes().Select(s => s.ToString()).First());

The expected output is

but Mono instead outputs

This happens with all Mono versions including 4.0.1.
Comment 1 eb1 2015-05-11 09:34:56 UTC
Fix for the 4.0 branch in PR #1787
Comment 2 Alexander Köplinger 2015-05-11 09:37:41 UTC
fyi, I just verified this produces the expected output with Mono from master.
Comment 3 Marek Safar 2015-05-18 03:38:56 UTC
Closing as it's already fixed in master
Comment 4 Abhishek 2015-05-27 07:30:04 UTC
I have checked this issue with the latest master Mono: MonoFramework-MDK- Now this issue is working fine .Here is the screeencast for the same:

Hence closing this issue.