Bug 29935

Summary: XAttribute.ToString() outputs wrong result if attribute contains namespace
Product: [Mono] Class Libraries Reporter: eb1
Component: System.XMLAssignee: Bugzilla <bugzilla>
Status: VERIFIED FIXED    
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
	xmlns:test="http://test.example.com"

but Mono instead outputs
	{http://www.w3.org/2000/xmlns/}test="http://test.example.com"

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-4.1.0.1736.macos10.xamarin.x86_4bacc38aacba5ecf48bac694eecab7cb8b05e8db. Now this issue is working fine .Here is the screeencast for the same:
http://www.screencast.com/t/rbYHYro3wi

Hence closing this issue.