Bug 20467 - Format document on duplicated attributes removes all text
Summary: Format document on duplicated attributes removes all text
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: XML Editor ()
Version: Trunk
Hardware: PC All
: Normal normal
Target Milestone: 5.5.4
Assignee: Mikayla Hutchinson [MSFT]
: 21381 23533 ()
Depends on:
Reported: 2014-06-09 03:26 UTC by David Karlaš
Modified: 2014-11-05 23:38 UTC (History)
8 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 David Karlaš 2014-06-09 03:26:51 UTC
Running Format Document on following XML(this is minimalistic sample) results in empty document(noticed two attributes with same name)
<XmlElement1 Attr1="" Attr1="" />
Comment 1 Prashant manu 2014-06-09 04:21:20 UTC
Checked, Running Format Document on XML <XmlElement1 Attr1="" Attr1="" />
results in empty document. Screencast: http://screencast.com/t/SpHp31QgI7

Environment Info:
XS 5.1 (build 415)
Git revision: 952688cfc5132fcd10f0218b8991114849fe0dd6
Xamarin addins: 2c39ca1ce8e771ebfd5bfb8cf699d1f2cfd9a4ac
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2014-08-21 13:28:35 UTC
It seems that anything the XML parser can't parse causes this problem.

Additional examples:

### Missing quotation mark

<XmlElement1 Attr1=" />

### Missing closing tag for an element

<XmlElement1 Attr1="">

### Invalid ampersand-escaped entity


I'm increasing the priority to "Normal" for 2 reasons:

1. Until Xamarin Studio 5.4 comes out, this problem combines in an unpleasant way with bug 20468. If someone runs "Format Document" on an invalid XML document, the document is erased, _and_ attempting to undo the change does not work. Instead the user will have to close the document and reopen it.

2. Now that many people are using XAML with Xamarin.Forms, many more users will hit this problem.

## Version information
Xamarin Studio (79dba444)

Mono 3.8.0 (no/62a857e)
GTK+ 2.24.23
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2014-08-21 13:37:37 UTC
*** Bug 21381 has been marked as a duplicate of this bug. ***
Comment 5 Matt Ward 2014-09-23 14:20:57 UTC
Should be fixed on master.

Xamarin Studio:
Commit: https://github.com/mono/monodevelop/commit/c6b1a471106fbb1eb47865b33b3ea7d75303eec6
Comment 6 Prashant manu 2014-09-26 07:34:08 UTC
We have checked this issue with Master XS and it is working fine.
Screencast: http://screencast.com/t/uMGUUwqBW

But with XS 5.5 (build 221) this issue still exists, as Running Format Document on XML results in empty document. Checked with <XmlElement1 Attr1="" Attr1="" />


As the target milestone is 5.5, please confirm whether fix would be available in 5.5 or milestone needs to be updated to master?

Hence reopening this issue.
Comment 7 Matt Ward 2014-09-26 07:38:06 UTC
It is fixed in 5.7 but not 5.5. I have updated the target milestone to 5.7.
Comment 8 Mike Krüger 2014-10-14 01:15:04 UTC
*** Bug 23533 has been marked as a duplicate of this bug. ***
Comment 9 Prashant manu 2014-11-05 23:38:46 UTC
Now running Format document on duplicated attributes doesn't removes all text. like for 
<XmlElement1 Attr1="" Attr1="" /> it is working fine.
Screencast: http://www.screencast.com/t/D28EHTuJO1P1

Environment Info:
Xamarin Studio
Version 5.5.4 (build 11)
Installation UUID: 0b7eaebc-a0ed-4b58-81df-91e378cad28c
	Mono 3.10.0 ((detached/e204655)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000023

Apple Developer Tools
Xcode 6.1 (6604)
Build 6A1052d

Version: (Indie Edition)

Version: (Indie Edition)
Hash: 80e9ff7
Build date: 2014-10-22 15:09:12-0400

Version: (Indie Edition)
Android SDK: /Users/Admin_Mac/Desktop/Anddk/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Build Information
Release ID: 505040011
Git revision: eeee7455222308275e32ba67790c0b42d904292b
Build date: 2014-11-04 19:49:29-05
Xamarin addins: 53c87071a252e02e7bc7a80bf735b9fd4a89339d

Operating System
Mac OS X 10.10.0
Darwin Admin-Macs-Mac-mini.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64