Bug 30105 - code formatting breaks this xaml
Summary: code formatting breaks this xaml
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: XML Editor ()
Version: 5.9
Hardware: PC Mac OS
: Normal normal
Target Milestone: master
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-05-14 19:16 UTC by George Cook
Modified: 2015-07-09 05:16 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description George Cook 2015-05-14 19:16:59 UTC
<?xml version="1.0" encoding="UTF-8"?>

<ContentPage
	xmlns="http://xamarin.com/schemas/2014/forms"
	xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
	x:Class="TwinTechs.Example.FastCellComplexSamplePage"
	xmlns:cells="clr-namespace:TwinTechs.Example.Cells;assembly=TwinTechsFormsExample"
	Title="FastCell Complex">

	<ContentPage.Content>

		<ListView
			x:Name="MediaItemsListView"
			BackgroundColor="Transparent"
			ItemSelected="OnItemSelected"
			SeparatorVisibility="None"
			RowHeight="300">

			<ListView.ItemTemplate>

				<DataTemplate>

					<cells:ComplexFastCell />
				</DataTemplate>
			</ListView.ItemTemplate>
		</ListView>
	</ContentPage.Content>
</ContentPage>

with settings: aling attributes (true), max attributes per line (true). always breaks the xaml.
It does this, screwing up the xmlns:cells="clr-namespace:TwinTechs.Example.Cells;assembly=TwinTechsFormsExample" line. It does that in every single file.

<?xml version="1.0" encoding="UTF-8"?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="TwinTechs.Example.FastCellComplexSamplePage"clr-namespace:TwinTechs.Example.Cells;assembly=TwinTechsFormsExample" Title="FastCell Complex">

	<ContentPage.Content>

		<ListView x:Name="MediaItemsListView" BackgroundColor="Transparent"
			ItemSelected="OnItemSelected" SeparatorVisibility="None"
			RowHeight="300">

			<ListView.ItemTemplate>

				<DataTemplate>

					<cells:ComplexFastCell />
				</DataTemplate>
			</ListView.ItemTemplate>
		</ListView>
	</ContentPage.Content>
</ContentPage>
Comment 1 George Cook 2015-05-14 19:19:01 UTC
note, if I move the xmlns:cells="clr-namespace:TwinTechs.Example.Cells;assembly=TwinTechsFormsExample"

line higher up, the code formatting still works.
However, in lots of cases that's where I want it.
Comment 2 Saurabh 2015-06-10 02:27:04 UTC
Hi George,

I have checked this Issue with this code and I am unable to reproduce this Issue at my end.

I have aling attributes (true)
max attributes per line (true)

This is the screencast for the same: http://www.screencast.com/t/bahDS0NX6z

X.S 5.9.1 (build 3)
Git revision: aad75a6e7e48f18120ce41f47d0ff2c6216f49c3

Could you please provide me screencast of the problem which you are facing? Also please provide me build info (Xamarin Studio->About Xamarin Studio)
Comment 3 George Cook 2015-06-10 08:13:12 UTC
In your video you are not formatting anything at all.

your document contains illegal xaml, (becuase you've not copy and pasted just
my example xaml; but instead the entire comment).

so you are not actually running the formatter.. you can see this very easily..
1. the resulting format doesn't match the settings, 2. if you still don't
believe me, just change the attributes, padding, etc and run the formatter -
you will observe nothing happens.

as it goes, this is another very irritating but.. if the xaml is not perfectly
formed, the formatter does NOTHING, with no warning or indicaiton to help one
resolve the xaml issue. very tedious indeed.

Please run this again, with just the xaml, not the entire message and verify
the xaml actually formats. you will see it re-produce the behaviour.


raised https://bugzilla.xamarin.com/show_bug.cgi?id=30970 about the silent
formatter failure.
Comment 4 xamarin-release-manager 2015-07-09 05:16:48 UTC
Fixed in version 5.10.0.338 (master)