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

Fix <ApplicationTitle> encoding in maui templates #22084

Merged
merged 9 commits into from
Jun 21, 2024

Conversation

MiYanni
Copy link
Member

@MiYanni MiYanni commented Apr 26, 2024

Summary

There is a bug where certain characters (in this case &) which are not valid in MSBuild/XML are being used as the <ApplicationTitle> in the maui-mobile template. To fix this, I made <ApplicationTitle> use a custom symbol instead of the default name parameter. This symbol uses xmlEncode to allow it to work properly in the .csproj file.

Issues Fixed

Fixes AB#2045293

Before/After

Before (using the project name Cats&Dogs):

image

After (using the project name Cats&Dogs2):

image

Fixes #21090

@MiYanni MiYanni requested a review from a team as a code owner April 26, 2024 19:25
@MiYanni MiYanni requested review from Eilon and jfversluis April 26, 2024 19:25
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Apr 26, 2024
@Eilon Eilon added the area-templates Project templates, Item Templates for Blazor and MAUI label Apr 26, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

jsuarezruiz
jsuarezruiz previously approved these changes Apr 29, 2024
@rmarinho
Copy link
Member

Can we add a unit test? there's some msbuild project tests I think.

Thanks

@MiYanni
Copy link
Member Author

MiYanni commented Apr 29, 2024

@rmarinho

Can we add a unit test? there's some msbuild project tests I think.

Where? I looked at src\Templates\tests and don't see anything of value there.

FYI, I haven't built or done anything of actual coding in this repo. All I did for this fix was:

  1. Install maui workload via CLI.
  2. Created a new project using the name Cats&Dogs, tried to run the dotnet publish command (like in the issue), and saw it fails.
  3. Went into the template-packs folder and found the maui nupkg.
  4. Extracted the contents, modified the template.json and .csproj for maui-mobile, then dropped the modified files back into the nupkg again.
  5. Did the same thing as Step 2 with the name Cats&Dogs2, saw that ApplicationTitle was encoded properly, and observed that publishing no longer errored for the reported reason.

@rmarinho
Copy link
Member

rmarinho commented May 3, 2024

We have a couple of them here

public class TemplateTests : BaseBuildTest

@jfversluis jfversluis added the s/pr-needs-author-input PR needs an update from the author label May 7, 2024
@MiYanni
Copy link
Member Author

MiYanni commented May 7, 2024

I don't have cycles to work on a unit test for this issue. I've had the DevOps work item assigned to the MAUI team.

@Eilon Eilon self-assigned this May 8, 2024
@Eilon
Copy link
Member

Eilon commented May 8, 2024

I tried the original repro and it seems still broken. I cloned this PR locally, built it, and ran dotnet new maui -n "𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞" (per the original bug), and the template was created, but then building it caused errors.

This is in the Build Output as an error:

1>C:\Users\elipton\.nuget\packages\microsoft.maui.resizetizer\8.0.7\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(766,9): error : Could not find a part of the path 'E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉%EE%80%B9㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\Platforms\Windows\Package.appxmanifest'.

And then another error shows up only in the Error List:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error (active)		Could not find a part of the path 'E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉%EE%80%B9㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\Platforms\Android\AndroidManifest.xml'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
   at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlTextReaderImpl.FinishInitUriString()
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
   at Xamarin.Android.Tasks.GetJavaPlatformJar.RunTask()	𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞ (net8.0-android)	C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.95\tools\Xamarin.Android.Tooling.targets	100		

@Eilon
Copy link
Member

Eilon commented May 8, 2024

And once I start opening other files in the project, such as XAML/C# files I get even more errors in the Error List:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	XLS0414	The type 'maui:MauiWinUIApplication' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.	𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞	E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\Platforms\Windows\App.xaml	1		
Error	XLS0429	Undefined namespace. The 'using' URI refers to a namespace 'Microsoft.Maui' that could not be found.	𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞	E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\Platforms\Windows\App.xaml	5		
Error (active)	CS0246	The type or namespace name 'ContentPage' could not be found (are you missing a using directive or an assembly reference?)	𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞ (net8.0-windows10.0.19041.0)	E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉%EE%80%B9㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\MainPage.xaml.cs	3		
Error (active)	CS0103	The name 'InitializeComponent' does not exist in the current context	𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞ (net8.0-windows10.0.19041.0)	E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉%EE%80%B9㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\MainPage.xaml.cs	9		
Error (active)	CS0103	The name 'CounterBtn' does not exist in the current context	𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞ (net8.0-windows10.0.19041.0)	E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉%EE%80%B9㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\MainPage.xaml.cs	17		
Error (active)	CS0103	The name 'CounterBtn' does not exist in the current context	𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞ (net8.0-windows10.0.19041.0)	E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉%EE%80%B9㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\MainPage.xaml.cs	19		
Error (active)	CS0103	The name 'SemanticScreenReader' does not exist in the current context	𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞ (net8.0-windows10.0.19041.0)	E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉%EE%80%B9㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\MainPage.xaml.cs	21		
Error (active)	CS0103	The name 'CounterBtn' does not exist in the current context	𫓧龦唉丂荳◎℉㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞ (net8.0-windows10.0.19041.0)	E:\repos\BugRepros\maui22084encodeapptitle\𫓧龦唉丂荳◎℉%EE%80%B9㐁&ᠭᠤ སྲིད خەل ꌠ ᥕ᧞\MainPage.xaml.cs	21		

Also as a note, whatever fix we end up with needs to be applied to all the relevant templates: maui, maui-blazor, maui multi-project, and the net9-only maui-blazor-solution.

@Eilon
Copy link
Member

Eilon commented May 8, 2024

For the case of dotnet new maui -n "dogs & cats" it builds fine for all platforms, but when I run it on Android Emulator I get this runtime exception:

Microsoft.Maui.Controls.Xaml.XamlParseException
  Message=Position 12:9. DataTemplateExtension: Could not locate type for local:MainPage.
  Source=Microsoft.Maui.Controls.Xaml
  StackTrace:
   at Microsoft.Maui.Controls.Xaml.DataTemplateExtension.ProvideValue(IServiceProvider serviceProvider) in D:\a\_work\1\s\src\Controls\src\Xaml\MarkupExtensions\DataTemplateExtension.cs:line 27
   at Microsoft.Maui.Controls.Xaml.DataTemplateExtension.Microsoft.Maui.Controls.Xaml.IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) in D:\a\_work\1\s\src\Controls\src\Xaml\MarkupExtensions\DataTemplateExtension.cs:line 32
   at Microsoft.Maui.Controls.Xaml.ApplyPropertiesVisitor.ProvideValue(Object& value, ElementNode node, Object source, XmlName propertyName) in D:\a\_work\1\s\src\Controls\src\Xaml\ApplyPropertiesVisitor.cs:line 286

And on Windows when I try to run it won't even let me and I get this error:

---------------------------
Microsoft Visual Studio
---------------------------
Unable to activate Windows Store app 'com.companyname.dogscats_9zz4h110yvjzm!App'. The activation request failed with error 'This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, please see the application event log'.



See help for advice on troubleshooting the issue.
---------------------------
OK   Help   
---------------------------

@dotnet-policy-service dotnet-policy-service bot added the stale Indicates a stale issue/pr and will be closed soon label May 19, 2024
@MiYanni
Copy link
Member Author

MiYanni commented May 20, 2024

I won't be able to get to doing unit tests anytime soon for this. This is still a valid fix for at least one issue with your templates. @Eilon pointed out many other issues, but the MAUI team would need to investigate those.

@MiYanni
Copy link
Member Author

MiYanni commented May 24, 2024

Seems your bot is broken, as I commented and it never unmarked the PR as stale.

@Eilon Eilon reopened this May 28, 2024
@MiYanni
Copy link
Member Author

MiYanni commented Jun 3, 2024

... I'll just let this fall off the plate. Up to you guys if you want to fix it.

@Eilon Eilon removed the s/pr-needs-author-input PR needs an update from the author label Jun 4, 2024
@Eilon
Copy link
Member

Eilon commented Jun 4, 2024

Sorry I forgot to take the label off the issue, so the bot closed it again.

I think this PR has some good changes in it but per my testing it didn't seem to fix the entire issue as stated in the original repro, which is I think what we'd be looking for in order to merge it.

@Eilon Eilon reopened this Jun 4, 2024
@MiYanni
Copy link
Member Author

MiYanni commented Jun 4, 2024

@Eilon Ah, I don't have any intention to fix the issue then. I only identified the immediate issue (which is still a problem) and fixed that. But the rest of the problems described are a chain of things that MAUI would need to investigate.

This comment was marked as outdated.

@Eilon

This comment was marked as outdated.

This comment was marked as outdated.

@Eilon

This comment was marked as outdated.

This comment was marked as outdated.

@Eilon

This comment was marked as outdated.

This comment was marked as outdated.

@Eilon
Copy link
Member

Eilon commented Jun 19, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Eilon
Copy link
Member

Eilon commented Jun 19, 2024

@MiYanni - thank you for your work on this issue! You found the critical bug and how to fix it. I extended that work to the other templates and added some tests to hopefully prevent future regressions. This was fantastic!

@Redth / @mattleibow / @jfversluis - this issue is related to Chinese GB18030 testing so I hope we can get this merged (after one unrelated flakey test passes). Unfortunately it's not possible to completely fix the issue due to two external bugs (dotnet/runtime#89538 and https://issuetracker.google.com/issues/347706983). But I suspect that after those two bugs are resolved, we should be in a good state due to properly encoding everything as of this PR.

@jfversluis
Copy link
Member

@dotnet/dotnet-maui-blazor-eng need an approval from one of your for the blazor part of this :)

@Eilon
Copy link
Member

Eilon commented Jun 20, 2024

@javiercn / @MackinnonBuck / @mkArtakMSFT - can one of you please review and sign off on the Blazor template changes? There is no behavioral change; this only ensures that template names are properly encoded wherever the text ends up in the project. Thanks!

@Eilon Eilon enabled auto-merge (squash) June 20, 2024 18:16
@Eilon
Copy link
Member

Eilon commented Jun 21, 2024

@mkArtakMSFT / @javiercn / @MackinnonBuck / @Redth - this should be an easy review. I'd like to get this in ASAP to help with sign-off, plus it'll unblock me working on the net9-only templates.

@Eilon Eilon merged commit 8181190 into dotnet:main Jun 21, 2024
47 checks passed
@Eilon
Copy link
Member

Eilon commented Jun 22, 2024

Thank you @MackinnonBuck !!

Redth added a commit that referenced this pull request Jun 25, 2024
* Size and SizeF should not throw on NaN

* Fix Release Versioning

* Upgrade from 1.5.1 to 1.5.4

* SwipeView Fix #22580 (#22741)

Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>

* Update vscode extension recommendations

* [XC] Fix SimplifyTypeExtensionVisitor (#23043)

* Add test

* Fix the visitor

* Add SR6 to issue template (#23071)

* Make sure the main branch is using .NET 8 SDK (#23077)

* Make sure the main branch is using .NET 8 SDK

The main branch needs to use the .NET 8 SDK because we are building the .NET 7 TFMs as well. The .NET 9 SDK does not support .NET 7 TFMs anymore.

* no previews!

* Setup preview versioning for SR6.1

* Remove compat appium tests

Since we're moving in a different direction for moving these over in #22635 these projects (and the Issue11853 test, since it's in the other PR) can be deleted.

* [main] Update arcade and xharness (#22981)

* Update arcade

* Update dotnet-tools.json

* Update xharness
# Conflicts:
#	.config/dotnet-tools.json
#	eng/Version.Details.xml
#	eng/Versions.props

* Remove more references to removed projects

* Make titlebar button foreground colors use app theme

* Update dependencies from https://github.com/dotnet/xharness build 20240612.3 (#23088)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 9.0.0-prerelease.24311.2 -> To Version 9.0.0-prerelease.24312.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* Add additional logging for PopLifeCycle

* Remove more legacy pipeline bits

* [iOS] Fixed NRE after calling ViewCell.ForceUpdateSize (#23094)

* [iOS] Fixed NRE after calling ViewCell.ForceUpdateSize

* - add test

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>

* Add x:DataType to the carousel view UI tests (#23113)

* Bump to Android 34.0.113

Context: https://github.com/dotnet/android/releases/34.0.113
Changes: dotnet/android@34.0.79...34.0.113

I noticed the Android workload version used in dotnet/maui/main was a couple service releases old.

We should use the latest one, as it has a memory leak fix for `Post()`.

* Squashed commit of the following: (#22874)

commit db8a3bd
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Mon Jun 10 13:46:16 2024 +0800

    Add android

commit 0bd2d65
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Mon Jun 10 12:16:34 2024 +0800

    oops!

commit 647e5f5
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Sat Jun 8 18:15:40 2024 +0800

    Almost

commit c3ea650
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Sat Jun 8 16:17:58 2024 +0800

    sadfasdf

commit d9a398f
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Sat Jun 8 13:56:34 2024 +0800

    screenshots

commit 4b3c01f
Merge: 595ff03 e94b364
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Sat Jun 8 13:54:52 2024 +0800

    Merge branch 'main' into dev/gif-in-release

commit 595ff03
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Thu Jun 6 21:00:52 2024 +0800

    Update ImageUITests.cs

commit 2c20fe0
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Thu Jun 6 19:05:23 2024 +0800

    Make some tests

commit 1e82e8b
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Thu Jun 6 18:44:18 2024 +0800

    Take 2?

commit d576c82
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Thu Jun 6 07:11:17 2024 +0800

    Fix animated gifs in Release builds

* Fix loaded so it fires on second subscription (#23095)

* Fix loaded so it fires on second subscription

* Update VisualElement.cs

* Make sure the view is still alive after posting (#23114)

I saw in some of my local testing the shape view may
actually be disposed if you write code or when you
run the device tests.

When we come back after the UI loop, make sure the
platform view is still alive.

This should not happen if the view is attached to the
UI since it is still being used, but if you happen to
navigate or close some popup it may occur.

* [iOS] TapGestureRecognizer should not fire when view is not enabled (#23049)

* Don't receive touch when view is disabled

* Add UITest for Single Tap enabled/disabled

This removes the first pass unit test version which isn't really testing the scenario properly.

* Fix element automation id

* Don't fire tap for windows if control disabled

* Make failure case text less confusing

* [Tests] Update to Appium 5.0.0 (#23118)

* Update to appium 5.0.0

Their driver has some removed methods (LaunchApp/CloseApp) which seem to be now implemented for windows.

Also removed an extra explicit ref to system.drawing.common since it comes in transitively from appium.webdriver package (and the version was causing issues since the newer appium.webdriver uses a newer version).

* Fix windows launchapp/closeapp for newer appium

In Appium's dotnet driver in v5.0.0 they removed `LaunchApp` from the driver: appium/dotnet-client#766

The deprecation suggests using `ActivateApp` as an alternative, but that throws an error saying it's not implemented on the windows driver.

Curiously, `CloseApp` which was also marked as deprecated was _moved_ from the base appium driver to the `WindowsDriver` here: appium/dotnet-client#773

I think the same treatment should have been done to the `LaunchApp` method since there's no alternative in windows.

For now the workaround is to invoke the command manually:
`windowsDriver.ExecuteScript("windows: launchApp", [_app.GetAppId()]);`

* Use correct interface type in FrameRenderer (#23124)

* Use correct interface type in FrameRenderer (#23124) (#23146)

* Squashed commit of the following: (#19629)

commit f6c3bfa
Merge: d0b3f84 3143629
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Mon Jun 17 19:58:40 2024 +0800

    Merge remote-tracking branch 'origin/main' into dev/macos-actionsheet

commit d0b3f84
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Tue Jun 11 05:00:38 2024 +0800

    Fix the older macOS testing

commit 3dc6b4d
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Mon Jun 10 23:40:40 2024 +0800

    macOS 13 things

commit e3e48e4
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Sat Jun 8 02:15:55 2024 +0800

    docs

commit 693d79c
Merge: 3dbce49 a3c872d
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Sat Jun 8 02:08:31 2024 +0800

    Merge remote-tracking branch 'origin/main' into dev/macos-actionsheet

commit 3dbce49
Merge: 17ea9c6 93a1bc4
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Sat Jun 8 02:06:16 2024 +0800

    Merge remote-tracking branch 'origin/main' into dev/macos-actionsheet

commit 17ea9c6
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Sat Jun 8 02:05:42 2024 +0800

    Fix the tests

commit 026da41
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Fri Jun 7 03:56:26 2024 +0800

    fixes

commit d2b85d5
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Thu Jun 6 23:58:33 2024 +0800

    namespaces

commit 9fa77cd
Merge: 3f9596b 9d71d32
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Thu Jun 6 23:57:00 2024 +0800

    Merge branch 'main' into dev/macos-actionsheet

    # Conflicts:
    #	src/Controls/samples/Controls.Sample.UITests/Test.cs
    #	src/Controls/src/Core/Platform/AlertManager/AlertManager.iOS.cs
    #	src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs
    #	src/Controls/tests/TestCases/Concepts/AlertsGalleryPage.cs
    #	src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs
    #	src/TestUtils/src/UITest.Appium/HelperExtensions.cs

commit 3f9596b
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Sat Dec 30 09:29:31 2023 +0200

    Add some UI tests

    Done: iOS/macOS/Android. TODO: Windows

commit 68c930f
Author: Matthew Leibowitz <mattleibow@live.com>
Date:   Tue Dec 19 18:15:51 2023 +0200

    macOS does not use PopoverPresentationController

    Fixes #18156

* [ios/catalyst] fix more cycles in `NavigationPage`

Fixes: #21453
Context: #22810

In #22810, a leak in `NavigationPage` was fixed for the case:

    Application.Current.MainPage = new NavigationPage(new Page1());
    Application.Current.MainPage = new Page2();

However, it does *not* work for the case:

    await Navigation.PushModalAsync(new NavigationPage(new Page1()));
    await Navigation.PopModalAsync();

I could reproduce this problem in `MemoryTests.cs`.

There were still a few cycles in `NavigationRenderer`:

* `NavigationRenderer` -> `VisualElement _element` -> `NavigationRenderer`

* `NavigationRenderer` -> `Page Current` -> `NavigationRenderer`

* `NavigationRenderer` -> `ViewHandlerDelegator<NavigationPage> _viewHandlerWrapper` ->  `TElement _element` -> `NavigationRenderer`

After fixing these cycles, the test passes.

`ViewHandlerDelegator` was slightly tricky, as I had to make a
`_tempElement` variable and *unset* it immediately after use.

* Only change ViewHandlerDelegator for iOS/Catalyst

* [ios] fix leak in ListView *Cells (#23143)

* [ios] fix leak in ListView *Cells

Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2064274

After fixing #22867 for `CollectionView`, there was still a problem with
`ListView`. The following types were leaking in the sample app:

* `UIKit.UITableView`
* `Microsoft.Maui.Controls.Handlers.Compatibility.ViewCellRenderer.ViewTableCell`
* `Microsoft.Maui.Platform.MauiLabel`
* `Microsoft.Maui.Platform.MauiImageView`
* `Microsoft.Maui.Platform.WrapperView`

After a lot of debugging, we found that `Cell` was holding a reference
to the `UITableView`. This pointed *up* in the hierarchy, creating
a cycle.

I updated an existing device test to ensure the problem is solved.

* Fix missing handlers in tests

* Remove assertion

* Fix UITableView reference

* Update a different test

* Can't enumerate while adding

* Missed a null check

* [Housekeeping] Added UI Test to validate project template (#18567)

* Added template UI Test

* Added pending snapshot

* Updated snapshot

* Generate snapshots for all the platforms

* Added pending snapshots

* Updated snapshot

* More changes

* Updated droid snapshot

* More changes

* Updated snapshots

* Added sample path

* Update Issue19509.cs

* Update Issue19509.cs

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>

* Optimize resetting gesture recognizers (#19987)

* reduce LINQ usage

* Remove useless check that will always be false

* use HashSet

* reduce enumerations and casting

* reduce LINQ usage

* only cast once

* add benchmarks

* fix build

---------

Co-authored-by: Edward Miller <symbiogenisis@outlook.com>

* [Windows] Fix ListView insert not working properly (#22746)

* Add test

* Remove force layout update during collection changed event

* Adjust await

* Update ListViewTests.Windows.cs

---------

Co-authored-by: Mike Corsaro <mikecorsaro@microsoft.com>

* Fix <ApplicationTitle> encoding in maui templates (#22084)

* Makes <ApplicationTitle> use a custom symbol instead of the default name parameter to ensure the name is XML encoded where necessaru
* Adds new tests for various encodings and special characters
---------

Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com>

* Fixed a null check #15102 (#23170)

* [ios/catalyst] fix memory leak in TabbedPage (#23166)

* [ios/catalyst] fix memory leak in TabbedPage

Context: #23164

Just the same way as `NavigationPage` in #23164, `TabbedPage` also has
a memory leak caused by the cycle:

* `TabbedPage` -> `TabbedRenderer` -> `VisualElement _element;` -> `TabbedPage

I could add a new `[Theory]` in `MemoryTests.cs` to see the issue.

This PR fixes the memory leak by breaking the cycle in `TabbedRenderer`.

* Ignore test on Windows

I also cleaned up the Task.Delay()

* [iOS] Set PlatformGraphicsView to transparent input (#23208)

* Avoid JavaCast and exceptions and ask Java (#23215)

* Wire RefreshView up to our xplat layout workflow (#23169)

* Use better layout/measure path with refreshview

* - fix naming

* - set RefreshView content to maui compatible container

* - add test

* - fix null operator

* Update Issue23029.xaml.cs

* - fix content panel so it removes previous content

* - add additional check

* Fix Merge

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
Co-authored-by: redth <jondick@gmail.com>
Co-authored-by: Šimon Rozsíval <simon@rozsival.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Mike Corsaro <mikecorsaro@microsoft.com>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vitaly Knyazev <VitalyKnyazev@users.noreply.github.com>
Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
Co-authored-by: Jonathan Dick <jodick@microsoft.com>
Co-authored-by: Edward Miller <symbiogenesis@outlook.com>
Co-authored-by: Edward Miller <symbiogenisis@outlook.com>
Co-authored-by: Mike Corsaro <corsarom@gmail.com>
Co-authored-by: Michael Yanni <MiYanni@microsoft.com>
Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com>
Co-authored-by: Tim Miller <drasticactions@users.noreply.github.com>
Eilon added a commit that referenced this pull request Jul 12, 2024
These were missed in the original PR #22084 for net8 templates, but I found this while working on the net9 templates in PR #23589.
rmarinho pushed a commit that referenced this pull request Jul 15, 2024
These were missed in the original PR #22084 for net8 templates, but I found this while working on the net9 templates in PR #23589.
@github-actions github-actions bot locked and limited conversation to collaborators Jul 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-templates Project templates, Item Templates for Blazor and MAUI community ✨ Community Contribution fixed-in-8.0.70 fixed-in-9.0.0-preview.6.24327.7 stale Indicates a stale issue/pr and will be closed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MAUI projects with an ampersand in the name can't be built or loaded
8 participants