Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate new lines in template files #1157

Open
6 tasks
MartinZikmund opened this issue Jan 6, 2025 · 6 comments
Open
6 tasks

Validate new lines in template files #1157

MartinZikmund opened this issue Jan 6, 2025 · 6 comments
Labels
kind/enhancement New feature or request. triage/untriaged Indicates an issue requires triaging or verification.

Comments

@MartinZikmund
Copy link
Member

What would you like to be added:

unoplatform/uno#18989

Based on this report, new lines might not be consistent across all template-generated files

Why is this needed:

For which Platform:

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Anything else we need to know?

@MartinZikmund MartinZikmund added kind/enhancement New feature or request. triage/untriaged Indicates an issue requires triaging or verification. labels Jan 6, 2025
@jeromelaban
Copy link
Member

The files in the repo are properly setup, it looks line dotnet new is mangling the contents, somehow.

May be related to dotnet/templating#1248

@MartinZikmund
Copy link
Member Author

I am getting this even for MainPage.xaml even with Blank app created from the wizard

Image

@jeromelaban
Copy link
Member

The wizard is using dotnet new internally, the issue must be in there.

@DevTKSS
Copy link

DevTKSS commented Feb 11, 2025

Researched on stack overflow to this issue
https://stackoverflow.com/questions/170961/whats-the-strategy-for-handling-crlf-carriage-return-line-feed-with-git

And checked the unoapp folder in the templates repo here

Screenshot_2025-02-11-23-39-58-261_com.github.android.jpg

And on the file ending .xaml there is none of this line ending attributes like on the xml or cs ones. On my fresh creates projects this issue is only and every time happening on xaml files, in the area of the namespaces and somewhere below but did not paied closer attention to this.

Also wondering about why there are different settings (lf and sometimes crlf) applied? Is there a reason why you choosen this instead of maybe lf for all? Windows prefers crlf and I do use it also in vs2022 but I think you might have had a reason to decide to this setting isnt it?

@MartinZikmund
Copy link
Member Author

From #741 - The EOL around these lines:

      xmlns:local="using:UnoApp4.Presentation"
      xmlns:uen="using:Uno.Extensions.Navigation.UI"
      xmlns:utu="using:Uno.Toolkit.UI"
      xmlns:um="using:Uno.Material"

appear to be \n instead of \r\n like the rest of the file. Looks like a bug from this line:

"value": "\n xmlns:utu=\"using:Uno.Toolkit.UI\""

(and similar lines)

@DevTKSS
Copy link

DevTKSS commented Feb 25, 2025

@MartinZikmund I would like to try out to pass a linebreak maybe in the xaml file which are having this issue, as alternative solution for this this on a forked branch, but dont know how I could set up that correctly, could you maybe help me with this?

How could I change that files in a local project and let it create a new one from that templates instead?

I compared the templates here in the repo and the lines, the CR LF Dialog is changing.
Lines to compare in the template files here:

  • App.xaml ln 8: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"$useThemesResourceNamespace$>
  • MainPage.xaml ln 4: xmlns:local="using:MyExtensionsApp._1"$toolkitNamespace$$materialNamespace$$mauiNamespaces$
  • Presentation\MainPage.xaml ln 4: xmlns:local="using:MyExtensionsApp._1.Presentation"$navigationNamespace$$toolkitNamespace$$materialNamespace$$mauiNamespaces$
  • Presentation\SecondPage.xaml ln 6: xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"$navigationNamespace$$toolkitNamespace$$materialNamespace$
  • Presentation\Shell.xaml ln 6: xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"$toolkitNamespace$

So what I am seeing is:

  • Everywhere this issue is occuring we have all of those namespace placeholders in the same line as the static one which is also included in the "marked as changed" after closing the Dialog.
  • In my new created app (blanc, desktop target, .net 8, mvux, di, material) I did not check toolkit and surprise: the Shell.xaml is not having that issue => the placeholder has not been used there, so did not cause an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request. triage/untriaged Indicates an issue requires triaging or verification.
Projects
None yet
Development

No branches or pull requests

3 participants