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

Make MAUI into 1 workload and lots of NuGets instead of a full workload #11206

Merged
merged 108 commits into from
Feb 7, 2023

Conversation

mattleibow
Copy link
Member

@mattleibow mattleibow commented Nov 9, 2022

Description of Change

This PR is to attempt to move towards a world where most MAUI bits are actually nugets.

We may require this in order to work with .NET 7:

Once this is merged you can still use all the same things as <UseMaui> will just now install nugets instead of use workloads. If you want to update the version of the nugets, you can just use the nuget package explorer - or use <MauiVersion>.

The only real fundamental change is that .NET MAUI is now entirely (almost) in NuGet packages instead of partially in nugets. This allows for cleaner updates. The aim of this PR is not to do away with workloads as they still offer several features we like, but rather move code that CHANGES into nugets. So we still want the magic of <UseMaui> or <UseMauiCore> but we also want to ensure that maui is determined by the nugets you install, not the workload you happen to be on.

Tasks:

  • Move all assemblies into nugets (core, controls essentials)
  • Move all targets into nugets (resizetizer and xamlc)
  • Make sure we still support net6
  • Write some docs on how things work

Testing

There are 2 ways to test this PR:

  1. Remove all Microosft.Maui.* from your NuGet caches (or just clear it all)
  2. Use the local .NET SDK for everything:
    1. Run dotnet cake --target=VS --pack --sln="/path/to/your/solution.sln"
    2. The IDE will launch and you can run using F5
  3. Use a global version of .NET MAUI (only supported on 7.0.58 and later)
    1. Download the NuGet artifacts from this PR or CI branch
    2. Extract the artifacts into a folder and add an entry in your NuGet.config to this folder (either in your solution directory or in VS)
    3. Open the project that you want to test with in the IDE
    4. Add the special property (just a temporary property until this PR is merged):
      <PropertyGroup>
          <UseMauiNuGets>true</UseMauiNuGets>
      </PropertyGroup>
    5. Add the new nugets to your project:
      <ItemGroup>
          <PackageReference Include="Microsoft.Maui.Controls" Version="VERSION_FROM_CI_HERE" />
      </ItemGroup>
    6. Due to Microsoft.Windows.SDK.BuildTools is missing buildTransitive microsoft/WindowsAppSDK#3251 you will also need to add the Microsoft.Windows.SDK.BuildTools package to windows:
      <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
          <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
      </ItemGroup>
    7. Run using F5

@Eilon Eilon added the area-setup Installation, setup, requirements, maui-check, workloads, platform support label Nov 9, 2022
mattleibow and others added 9 commits November 11, 2022 09:17
Makes things easier as the pack of the non-design versions (Controls Core and Xaml) depend on these dlls prebuilt. We can still do something with project references to be more magical, but not necessary here.
* Add macOS debug info

* Fix variable
* Update dependencies from https://github.com/xamarin/xamarin-macios build 20221114.10

Microsoft.iOS.Sdk
 From Version 16.1.1467 -> To Version 16.1.1468

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20221114.10

Microsoft.tvOS.Sdk
 From Version 16.1.1467 -> To Version 16.1.1468

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20221114.10

Microsoft.macOS.Sdk
 From Version 13.0.2022 -> To Version 13.0.2023

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20221114.10

Microsoft.MacCatalyst.Sdk
 From Version 16.1.1467 -> To Version 16.1.1468

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
@mattleibow mattleibow marked this pull request as ready for review November 15, 2022 16:15
@mattleibow mattleibow changed the title Try creating workload packs instead Make MAUI into 1 workload and lots of NuGets instead of a full workload Nov 15, 2022
@mattleibow mattleibow marked this pull request as draft November 15, 2022 16:22
mattleibow and others added 10 commits November 16, 2022 00:07
* Update dependencies from https://github.com/xamarin/xamarin-macios build 20221115.12

Microsoft.iOS.Sdk
 From Version 16.1.1468 -> To Version 16.1.1469

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20221115.12

Microsoft.tvOS.Sdk
 From Version 16.1.1468 -> To Version 16.1.1469

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20221115.12

Microsoft.macOS.Sdk
 From Version 13.0.2023 -> To Version 13.0.2024

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20221115.12

Microsoft.MacCatalyst.Sdk
 From Version 16.1.1468 -> To Version 16.1.1469

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

* - remove classes from blazor tests

* - register correct ApplicationStub

* - use default mauiprogram

* - move stubs back

* - move more stubs back

* - remove frame related fix updates

* - fix viewhandler

* Update ViewHandler.cs

* - move all core specific tests to new project

* - add shared to blazor tests

* - fix build errors

* - comment out Tizen

* - fix font registration

* - scope dokdo registration to test

* - just set WxH if measure are still infinity

* - comment out search bar tests

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
Co-authored-by: Matt Goldman <matt.goldman@outlook.com>
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does anything test that net7.0 projects continue to work? What about net6.0?

@mattleibow
Copy link
Member Author

mattleibow commented Jan 30, 2023

Thanks for all the reviews @jonathanpeppers ! I did observe the crazy things again with the IDE and the capabilities. I think I found out where/what caused the issues, but we are safe in this PR. I can reproduce and then fix the issue reliably, so I am almost confident it is not going to cause issues...

@yunusefendi52
Copy link
Contributor

I have a couple questions for this:

  1. Can I use MAUI without downloading the workload? like the way Xamarin.Forms used to
  2. Is this also going to make MAUI supports any underlying dotnet ios/android version? Current version (7.0.59) needs dotnet ios 16.2 but if I use dotnet ios 16.0 it wouldn't work because MAUI needs 16.2.
    Xamarin.Forms doesn't really care what Xamarin ios/android version you use technically, if MAUI doesn't support that then I think it's still a stepback. I'd say dotnet workload system is a stepback generally

@mattleibow
Copy link
Member Author

@yunusefendi52 to answer your question, almost.

TL;DR

No, we still need workloads. This is phase 1 of reducing workload version restrictions. This PR makes it so you don't need to care what version you have installed as you now use nugets for that.

Long answer

This PR does not aim to make it workload-free as we do get some nice things. However, Windows and the IDE need more attention. One of the core issues is that the IDE decides what menu options and toolbar actions to do based on project capabilities - and these cannot be in nugets.

In the old world, Xamarin.Forms had separate projects with project type GUIDs to do this. In .NET 6+ this is now the responsibility of the workloads. This allows actions to be influenced by a SDK outside the IDE.

During the hacks I was doing recently, it appears that because workloads are just a "wrapper" around the existing SDK importing and things like that - think the MSBuild.SDK.Extras if you are familiar, we can potentially have our own SDK and then will not need workloads.

But, the core goal of this PR is to get all changing logic into nugets, so almost we don't need workloads. What this presents itself after the merge of this PR is that it won't matter what workload you have installed because there is no changing code in there. If you want a different maui version, either use MauiVrsion - or just select the version using the NuGet package manager.

@mikeparker104 mikeparker104 added the partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with label Feb 2, 2023
Copy link
Member

@Eilon Eilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what I've done:

  • Run the branch locally on a Windows machine to run the Windows and Android samples in the MAUI solution
  • On the same machine, I created new MAUI / MAUI Blazor projects and run them with this change
  • Did editing in VS, debugging, etc.
  • Reviewed the code changes in the PR
  • Inspected the contents of the built NUPKGs

I do have two areas of unknowns/concerns that I think need to be addressed at some point:

  1. There is a very long VS hang after debugging the Controls Sample app on Windows in the MAUI solution. On a very high end dev machine VS hangs for 2-3 minutes and the VS UI is "ghosted" (unresponsive, not rendering). It does eventually wake up. This doesn't happen with Android. Running without debugging is not affected. This has been reported to VS. I think this could make working in the MAUI solution very difficult. I'm not sure if this affects less complex solutions.
  2. While I verified that the built NuGet packages indeed contain what I expected them to contain, I am not able to verify whether this change would in fact enable customers to pick their MAUI versions, do various side-by-side scenarios, etc.

In totality, this PR looks good, so I sign off.

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll finish reviewing next week. Mainly just want to read the files GitHub says changed since last time.

Is there any concern to merge this prior to branching .NET 8 Preview 1? Maybe we should merge right after branching is done?

@mattleibow mattleibow merged commit 2dcc148 into main Feb 7, 2023
@mattleibow mattleibow deleted the dev/testing-nugets branch February 7, 2023 13:09
Redth added a commit that referenced this pull request Feb 18, 2023
* Added samples

* Fix the bug

* Added device tests

* Microsoft.Maui.ApplicationModel.Permissions: add Bluetooth permissions for Android (#12264)

* Android 12 has a new Bluetooth (runtime) permission scheme
* there are three different flavours; we request those that are present in the manifest

* Essentials: update public API (#12264)

* add Microsoft.Maui.ApplicationModel.Permissions.Bluetooth

* Remove obsoleted OpenGLView

* Restore accidentally deleted files

* Removed unnecessary loop

* Fix DotNetCoreTestSettings.Logger warning (#13068)

* added monochrome element to the AdaptiveIconDrawableXml (#12564)

To supporting user theming of app icons I've added the monochrome element to the AdaptiveIconDrawableXml

* Fix EvaluateJavaScriptAsync using Compatibility WebView Renderer (#12901)

* Fix Download warning (#13067)

* [create-pull-request] automated change (#13070)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix Html text rendering issue on Android

* Fix crash with a hidden CarouselView on iOS

* fix: Fixed nullable annotations for WeakEventManager. (#12950)

* Update CONTRIBUTING.md (#13093)

Removing references to handler PRs, since those have been done for ages.

* Remove Deprecated Application.Properties (#13089)

* Update dependencies from https://github.com/xamarin/xamarin-android build main-47a1df7b6911dc30b52164766984d3ed3c4f004e-1

Microsoft.Android.Sdk.Windows
 From Version 34.0.0-preview.1.147 -> To Version 34.0.0-preview.2.148

* [Windows] Fixes DatePicker format (#9924)

* Fixes Windows DatePicker format

* Fixes 'ddd' day format

* Fixes test

---------

Co-authored-by: Andrés Giudici <agiudici@tpssa.com.ar>

* Disable codeQL test

* Update WebAuthenticator to support custom ResponseDecoder (#11641) (#11710)

* (#11641) Added support for ResponseDecoder passed in the options.

* (#11641) Added CallbackUri as an optional property of the WebAuthenticatorResult

* (#11641) Added to Public API

* (#11641) Added IWebAuthenticatorResponseDecoder to public API

* (#11641) Added changes to WebAuthenticatorOptions to public API.

* (#11641) Split the ctor for WebAuthenticatorResult so there is no breaking change in public API.

* (#11641) Added public API definition for tizen

* Update src/Essentials/src/WebAuthenticator/WebAuthenticator.shared.cs

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Update src/Essentials/src/WebAuthenticator/WebAuthenticatorResult.shared.cs

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Update src/Essentials/src/PublicAPI/net-android/PublicAPI.Unshipped.txt

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Update src/Essentials/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Update src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Update src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Update src/Essentials/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Update src/Essentials/src/PublicAPI/net/PublicAPI.Unshipped.txt

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Update src/Essentials/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* (#11641) Moved docs into XML comments.

* (#11641) docs to XML comments

* (#11641) Removed XML docs for WebAuthenticator

* (#11641) Correct runfails for included xml fragments

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Remove PhoneDialer.Current (#13079)

* [listview] fixes for various null/empty DataTemplate

Fixes: #11203

The following breaks XAML Hot Reload:

1. Setup a working `ListView` and `DataTemplate`

2. Delete the `DataTemplate`'s body (as if I'm about to type a
   completely new view there).

3. Trigger a XAML Hot Reload. This can happen automatically if you
   just pause typing.

4. MAUI crashes at runtime:

    in Android.Views.ViewGroup.Layout at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.ViewGroup.cs:3369,5
    in Microsoft.Maui.Controls.Handlers.Compatibility.VisualElementRenderer<Microsoft.Maui.Controls.ListView>.OnLayout at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Android\VisualElementRenderer.cs:54,6
    in Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.OnLayout at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\ListView\Android\ListViewRenderer.cs:298,4

You can also create this problem in C#, like I did in a unit test:

    listView.ItemTemplate = new DataTemplate(() => /* valid template */);
    listView.ItemTemplate = new DataTemplate(); // broken
    listView.ItemTemplate = new DataTemplate(() => null); //broken

I could also get a slightly different crash:

    System.InvalidCastException: Specified cast is not valid.
    at Microsoft.Maui.Controls.Internals.TemplatedItemsList`2[[Microsoft.Maui.Controls.ItemsView`1[[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ActivateContent(Int32 index, Object item)

The "invalid cast" appears to be due to the changes in c57858f. It
returns a `new Label()` in some cases, which does not work with a
`ListView`. You need a `Cell` instead of `View` in that case.

The fixes appear to be in two places:

* `VisualElementRenderer.OnLayout`: use `is`, also simplifies the code

* `TemplatedItemsList.ActivateContent` : use `is` and call the default
  data template.

Now my tests pass, and I can't reproduce the issue in XAML Hot Reload
either!

* [iOS] Fix Entry Next Keyboard Button Finds Next TextField  (#11914)

* Enable the Next button on keyboard to find next text field - ios

* Use the most top superview or allow user to specify

* Add message for IQKeyboard and stop the upward search as the ContainerViewController

* add ThirdPartyNotice.txt from Android repo

* remove the ThirdPartyNotices.txt file for now

* address Shane comments and use more efficient search for next field

* make the search modular and more generic to fit inside ViewExtensions.cs

* change signatures for tests

* add third party notice

* Change names, support RightToLeft, loop back to beginning

* add comment for IsRtl

* Use logical tree ordering, add more unit tests, and create horizontalstacklayoutstub

---------

Co-authored-by: TJ Lambert <tjlambert@microsoft.com>

* Resolve some life cycle issues with `TabbedPage` when nested inside a `NavigationPage` (#11530)

* Fix fragment manager life cycle with TabbbedPage

* - add additional tests

* - add more tests and fix a couple more found issues

* - remove testing code

* - fix up tabbedpage gallery

* - fix up tests

* - fix up fragment management

* - cleanup

* - add additional tests

* - add delay

* Update StackNavigationManager.cs

* Update TabbedPageTests.cs

* Update ControlsHandlerTestBase.cs

* - remove disable nullable

* - add comment fix traversal

* - cleanup Destory checking code and add gallery tests

* - cleanup handling of adapter key

* - comment out ios

* - fix scenarios where navpage gets disconnected mid navigation

* Update MultiPageFragmentStateAdapter.cs

* Fix Modal page offset measuring for AdjustPan and AdjustResize (#12661)

* Watch for margin

* Fix modal margins and measuring when soft keyboard opens

* - fix offsets

* - force tests to setup testing scenario

* Update ModalNavigationManager.Android.cs

* - add additional comments

* Fix initial page and back button Navigation events (#12348)

* Fix initial page and back button Navigation events

* - add tests for backbutton

* - add comments and consolidate

* Update VisualElement.cs

* - validate pushed page fires navigated

* - fix tests

* - fix tests for reals

* Correctly propagate BindingContext in all ContentView scenarios (#12536)

* Correctly propagate BindingContext in all ContentView scenarios

* Apply suggestions from code review

Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>

* Updated samples

* Updated sample

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>

* [iOS] Use same font size for Editor/Entry placeholders (#13140)

* [iOS] Use same font size for placeholder

* [iOS] Update placeholder fontsize when UITextView Font is updated

* Fix getting _defaultPlaceholderSize only 1 time

* [create-pull-request] automated change

* [iOS] Simplify the code used to set the same font size for Editor/Entry.

PR #13140 landed with a property
implementation that is more complicatd than needed (also a little
unsafe).

Changes in this PR:

1. Use a nullable nfloat to ensure that we do not use a magic number as
   the default value of the variable.
2. Simplify the if nests. There is no needed to have that many nested
   code to achiecve the same. This implementation does the same with a
   much simpler approach.

* Use `is not`, save a few lines of code

* Update src/Core/src/Platform/iOS/MauiTextView.cs

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Update src/Core/src/Platform/iOS/MauiTextView.cs

* Even simpler.

* Bump Xamarin.Firebase.AppIndexing from 120.0.0.10 to 120.0.0.11

Bumps [Xamarin.Firebase.AppIndexing](https://github.com/xamarin/GooglePlayServicesComponents) from 120.0.0.10 to 120.0.0.11.
- [Release notes](https://github.com/xamarin/GooglePlayServicesComponents/releases)
- [Commits](https://github.com/xamarin/GooglePlayServicesComponents/commits)

---
updated-dependencies:
- dependency-name: Xamarin.Firebase.AppIndexing
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Make MAUI into 1 workload and lots of NuGets instead of a full workload (#11206)

### Description

This change moves most - if not all - the logic, assemblies, build tasks, targets and props into NuGet packages. This allows .NET MAUI to be usable without having to care about what version of the workload is installed.

There are still a few things - mostly the automagic and Windows fixes - in the workload pack, but this is probably temporary and/or non-essential for the working of the build. Things like the project capabilities are still in the workload as this is needed for the IDE and cannot be in NuGet packages.

Everything else is now inside a NuGet package that can be upgraded, pinned and otherwise used without requiring VS to have installed the workload to match. There is the benefit of the NuGet packages being installed on disk and thus reducing/removing the need to download. But that is minimal now since we have smaller and fewer packages.

* Bump Xamarin.GooglePlayServices.Maps from 118.1.0 to 118.1.0.1

Bumps [Xamarin.GooglePlayServices.Maps](https://github.com/xamarin/GooglePlayServicesComponents) from 118.1.0 to 118.1.0.1.
- [Release notes](https://github.com/xamarin/GooglePlayServicesComponents/releases)
- [Commits](https://github.com/xamarin/GooglePlayServicesComponents/commits)

---
updated-dependencies:
- dependency-name: Xamarin.GooglePlayServices.Maps
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add the new dll to the sign list (#13168)

* [iOS] Fix issue using SVG in SwipeItem Icon (#12882)

* Set the SwipeItem Icon with the correct size after load the SwipeItem (Frame is not empty)

* Added comments

* Make SwipeItemButton public and add to public api

---------

Co-authored-by: Rui Marinho <me@ruimarinho.net>

* Remove Navigation workaround (#13170)

* Add some capabilities! (#13171)

* Fix the WorkloadManifest.json (#13172)

* [create-pull-request] automated change

* Fix a couple life cycle scenarios on shell modals (#13177)

* Fix a couple life cycle scenarios on shell modals

* - cleanup code

* Don't auto-close s/move-to-vs-feedback issues (#13209)

After discussion with the VS tooling folks, we decided it can be harmful to auto-close these issues because we can end up losing issues entirely if they never get moved to VS feedback and/or Azure DevOps.

We'll look into how to automate these issues, but for now we want to stop losing data.

* Close open cursors correctly (#13202)

* [Windows] Add convenience and nullable safe method. (#13205)

During the code reviews I have noticed several occurrences of the of the
following pattern:

```csharp
if (nativeSlider.GetFirstDescendant<Thumb>() is Thumb thumb)
{
  thumb.Height = defaultThumbSize.Value.Height;
  thumb.Width = defaultThumbSize.Value.Width;
}
```

The above works, but it is abussing the is operator and is making us
type more than is really needed (several ocurrences of the type). The
given method will be used as follows:

```csharp
if (nativeSlider.TryGetFirstDescendant<Thumb>(out var thumb))
{
  thumb.Height = defaultThumbSize.Value.Height;
  thumb.Width = defaultThumbSize.Value.Width;
}
```
or
```csharp
if (nativeSlider.TryGetFirstDescendant(out Thumb? thumb))
{
  thumb.Height = defaultThumbSize.Value.Height;
  thumb.Width = defaultThumbSize.Value.Width;
}
```
Nullability is not needed thansk to the NotNullWhenAttribute.

* Fix back button tap for older iOS APIs (#13204)

* Fix back button tap for older iOS APIs

* - fix ios14

* Add NotNullWhen to IsAlive() (#13214)

* Add more tests for Graphics (#13208)

* Wire up WebView2 to window life cycle (#13206) Fixes #10436 Fixes #8323 Fixes #7317 Fixes #12956

* [Android] Fix crash setting SelectedTabColor on TabbedPage (#12924) Fixes #12904

* Fix crash setting SelectedTabColor on Android TabbedPage

* Update src/Controls/src/Core/Platform/Android/TabbedPageManager.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* Refactoring code

* Small refactoring and included comments

* Changes based on feedback

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* [create-pull-request] automated change (#13217)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update dependencies from https://github.com/xamarin/xamarin-android build main-a9313d52448f931709844a7faf71b2761b0158c9-1 (#13199)

Microsoft.Android.Sdk.Windows
 From Version 34.0.0-preview.2.148 -> To Version 34.0.0-preview.2.149

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

* [main] Update dependencies from xamarin/xamarin-macios (#13195)

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20230208.7

Microsoft.iOS.Sdk
 From Version 16.2.1024 -> To Version 16.2.1025

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20230208.7

Microsoft.tvOS.Sdk
 From Version 16.1.1521 -> To Version 16.1.1522

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20230208.7

Microsoft.macOS.Sdk
 From Version 13.1.1024 -> To Version 13.1.1025

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20230208.7

Microsoft.MacCatalyst.Sdk
 From Version 16.2.1024 -> To Version 16.2.1025

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20230208.12

Microsoft.iOS.Sdk
 From Version 16.2.1024 -> To Version 16.2.1026

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20230208.12

Microsoft.tvOS.Sdk
 From Version 16.1.1521 -> To Version 16.1.1523

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20230208.12

Microsoft.macOS.Sdk
 From Version 13.1.1024 -> To Version 13.1.1026

* Update dependencies from https://github.com/xamarin/xamarin-macios build 20230208.12

Microsoft.MacCatalyst.Sdk
 From Version 16.2.1024 -> To Version 16.2.1026

---------

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

* [iOS] Better Find Next Textfield Algo (#13174)

* Use the better algorithm

* prepare for nulls and index less

---------

Co-authored-by: TJ Lambert <tjlambert@microsoft.com>

* [Android] Align dash effect between Border and Shapes (#12693)

* Align dash effect between Border and Shapes on Android

* Update src/Core/src/Graphics/MauiDrawable.Android.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* [Android] Avoid to update Shell Toolbar colors if already disposed the Tracker (#12539)

* Avoid to update Shell Toolbar colors if already disposed the Tracker

* Changes from PR feedback

* Update src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarAppearanceTracker.cs

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

---------

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

* Fix wrong conversions between Graphics RectF and Android RectF (#13225)

* [build] use stable bits in main (#13201)

Context: #11805
Fixes: #12762

There are various NuGet feed issues caused by using nightly builds of
.NET SDK and workloads. #11805 also appears to be blocked by an
unknown problem -- meaning we are using older bits in `main`
currently.

To use stable bits:

* Hardcode the latest stable version numbers of everything.

* Pass `--version 7.0.101` to the `dotnet-install` script.

* Work around the weird, unknown build errors?

Other changes:

* Pass `--skip-sign-check` so that the `tizen` workload can be
  installed with a signed .NET SDK. We already do this on various
  release branches like `release/8.0.1xx-preview1`.

* Build `Microsoft.Maui-mac.slnf` in parallel, this apparently works
  around the unknown issue in #11805?

* Remove `$(DotNetFeedUrl)`, as it breaks the `dotnet-install` script
  on macOS. This URL changes from time to time.

* Build for a single maccatalyst RID in some projects. This attributed
  to other build errors once `Microsoft.Maui-mac.slnf` built in parallel.

Tracking this in: xamarin/xamarin-macios#17497

* Don't refresh the filtered tests if the filter hasn't actually changed (#13236)

* [CI] Install the android and iOS dotnet version when they are diff to the maui one. (#13228)

* [CI] Install the android and iOS dotnet version when they are diff to the maui one.

This extra conditional command execution allows to install the donet
versions needed by the android and iOS runtimes. This will allow us to
be able to work around a situation in which there is a mismatch between
the SDKs.

* Get the versions from the sdk props.

* Fix pwsh install, use MicrosoftNETCoreAppRefPackageVersion

---------

Co-authored-by: Peter Collins <pecolli@microsoft.com>

* fix shadow visibility on Windows (#10996)

* [create-pull-request] automated change (#13237)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* [Android] Fix shadows size in clipped views (#11603) Fixes #11578

* Fix shadows clipping views

* Fix build errors

* Capture and cache Context usage

We've found Context can be a bit expensive to get in a large frequency of calls (#8001), so we can avoid this by capturing and caching the instance.

* Removed duplicated test

* Revert latest changes

---------

Co-authored-by: redth <jondick@gmail.com>
Co-authored-by: Rachel Kang <rachelkang@microsoft.com>

* [iOS/Catalyst] Fix Shell TitleView rendering issues on iOS 16  (#12834) Fixes #10128 Fixes #11309

* Fix the issue

* Added a sample in the Gallery

* Added Device Test

* Fix test

* Update src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

---------

Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* Remove TargetIdiom (#13090)

* Remove TargetIdiom

* Update Device.cs

* Fix unshipped txt files

---------

Co-authored-by: Rui Marinho <me@ruimarinho.net>

* [core] `WeakEventManager+Subscription` needs `IEquatable` (#13232)

Context: https://github.com/Vroomer/MAUI-master-detail-memory-leak
Context: #12039

Using the Visual Studio's `.NET Object Allocation Tracking` profiler
on the sample above I noticed after app launch:

    Microsoft.Maui.WeakEventManager+Subscription
    Allocations: 686,114
    Bytes: 21,955,648

After spitting out my coffee, I drilled in a bit to see where these
are being created:

    System.Collections.Generic.ObjectEqualityComparer<Microsoft.Maui.WeakEventManager+Subscription>.IndexOf

It turns out this `struct` doesn't implement `IEquatable<T>`:

https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815

To solve this:

* `Subscription` is private, so we can make it a `readonly struct`.

* `dotnet_diagnostic.CA1815.severity = error` across the entire repo.

* Implement `IEquatable<T>` for all `struct` types.

After these changes, I can't find `Microsoft.Maui.WeakEventManager+Subscription`
in the memory report at all. Which assuming means, I saved ~21 MB of
allocations in this app.

Note that this doesn't actually solve #12039, as I'm still
investigating the leak. Maybe this partially closes the floodgate?

* Fix `struct`s in Controls.Core

Note that I did not update these, as they are some "internal" parts
from Xamarin.Forms:

* `Profile`
* `Datum`

We might actually just consider removing these in the future.

* Suppress warnings in Compatibility

I assume these structs aren't nearly as important, so ignoring a few.

They appear to be called once at startup in most cases.

* Disable `CA1815` in tests.

* feat: Added nullable annotations for IValueConverter. (#13173)

* feat: Added nullable annotations for IValueConverter.

* feat: Added nullable annotations for IValueConverter.

* Remove Compatibility packages by default (#13165)

* Remove Compatibility packages by default

* we need thisin our sample

* [Windows] Fix issue with caching the page that holds unfocused control (#13028)

* [Windows] Fix issue with caching the page that holds unfocused control

* Simplify condition

* [test] Use AutoResetEvent for entry focus test

* Use tabStop to unfocus

* [Housekeeping] Revert changes from 11721 (#13253)

* Revert changes from 11721

* Revert device tests

* Update Essentials SMS API Docs (#12849)

* Add Essentials SMS API Docs

* Update Sms.shared.cs

* Update src/Essentials/src/Sms/Sms.shared.cs

Co-authored-by: E.Z. Hart <hartez@users.noreply.github.com>

---------

Co-authored-by: E.Z. Hart <hartez@users.noreply.github.com>

* Let the Grid skip * measurements during the first pass if they'll be overwritten later (#13255)

* [CI] Allow to find the eng folder when multiple projects are checkedout. (#13254)

One of the curious decisions from the VSTS team was to use a different
directory for the checkout depending if the project was checkoued alone
or was checkedout along with other repos.

If we only check out maui, the directory will be the
$(DefaultWorkingDirectory), but if are checkingout other repos, the
directory will be $(DefaultWorkingDirectory)/maui".

In order to be able to use the provisioning scripts from other pipeline
along other projects (megapipeline) we must adapt our templates to that
diff directory structure.

* [create-pull-request] automated change

* [CI] Allow to pass the checkout dir to the packs template. (#13264)

* Update dotnet-autoformat-pr.yml (#13296)

* [housekeeping] Update dotnet-autoformat-pr.yml (#13300)

* Update dotnet-autoformat-pr.yml

* Fix github comment

* [Windows] Correctly set the Slider ThumbImageSource (#13194)

* Correctly set the Windows Slider ThumbImageSource

* Update src/Core/src/Handlers/Slider/SliderHandler.Windows.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* Update src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* Updated sample

* Refactoring code

* Refactoring code

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* When measuring FlexLayout unconstrained, allow child to be desired size (#13216)

* When measuring FlexLayout unconstrained, allow child to be desired size (rather than zero)
Fixes #11909

* Fix issue on Windows with HorizontalStackLayout

* De-duplicate some test code

* [Essentials] Geolocation foreground listening (#9572)

* added geolocation foreground listening public API without implementation

* added section on geolocation sample page for foreground listening feature

* implemented geolocation foreground listening for Android, iOS, MacOS and UWP

* moved common code for determining DesiredAccuracy on UWP to extension method

* renamed class ListeningRequest to GeolocationListeningRequest

* renamed property IsListening to IsListeningForeground

* added xml documentation for all new public methods and properties

* implemented event LocationError, using enum GeolocationError and class GeolocationErrorEventArgs

* fixed potential leak where ContinuousLocationListener keeps the reference to the GeolocationImplementation on iOS

* changed StopListeningForegroundAsync() to StopListeningForeground() and return void

* fixed error in Essentials samples where async keyword is not necessary anymore

* enabled nullable checks for GeolocationListeningRequest class

* renamed ListeningRequest.ios.macos.cs to match class name; no source code changes

* call StopListeningForeground() on Android, iOS and macOS before signalling LocationError event, to make behavior consistent with Windows

* replaced throwing ArgumentNullException with ArgumentNullException.ThrowIfNull()

* added xml documentation for all newly added public geolocaion foreground listening APIs

* removed duplicated code for determining GeolocationAccuracy on iOS and macOS

* renamed event LocationError to ListeningFailed and GeolocationErrorEventArgs to GeolocationListeningFailedEventArgs

* fixed IsListeningForeground property on Windows

* Fixed naming

---------

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* [controls] fix memory leak in Style and AttachedCollection (#13260)

Context: https://github.com/Vroomer/MAUI-master-detail-memory-leak
Context: https://github.com/symbiogenesis/Maui.DataGrid/tree/memory-leak
Context: #12039

Using the Visual Studio's `.NET Object Allocation Tracking` profiler
on the sample above I noticed after using the app and taking snapshots:

Snapshot 2:

    WeakReference<Microsoft.Maui.Controls.BindableObject>
    Count: 1,545
    Bytes: 37,080

Snapshot 10:

    WeakReference<Microsoft.Maui.Controls.BindableObject>
    Count: 1,657
    Bytes: 39,768

It appears memory usage is slowly growing by about ~2.45KB each time I
navigate forward a page then return.

f8171b4 introduced a `CleanupTrigger`, but the code has a slight issue:

    void CleanUpWeakReferences()
    {
        if (_targets.Count < _cleanupThreshold)
        {
            return;
        }

        _targets.RemoveAll(t => !t.TryGetTarget(out _));
        _cleanupThreshold = _targets.Count + CleanupTrigger;
    }

Because `_cleanupThreshold` is modified at the bottom of this method,
the `_targets` collection increases by 128 in size over time. The
result being lots of tiny `WeakReference<T>` objects in memory, but
not the actual underlying `T` target.

I did a little research to try to find a better collection than
`List<WeakReference<T>>`:

* https://learn.microsoft.com/dotnet/api/system.runtime.compilerservices.conditionalweaktable-2
* https://source.dot.net/#Microsoft.Extensions.Caching.Memory/MemoryCache.cs
* https://source.dot.net/#PresentationFramework/System/Windows/Input/KeyboardNavigation.cs,08271c29723aa10a

I did not find one that exactly met our needs, so I wrote a very
simple `WeakList<T>`. It cleans up `WeakReference<T>` that are no
longer alive after N operations. I set this threshold to 32 to start,
we can modify this later if needed. This makes the above samples call
it a couple times for large `CollectionView`'s, which seems reasonable.

After these changes, I'm able to navigate in the app over and over
with stable memory usage:

| ID | Objects | Heap Size     |
| -- | --:     | --:           |
| 1  | 107,885 | 407,645.87 KB |
| 2  |   2,267 | 401,126.22 KB |

This was after navigating through the app *many* times, and it
actually went *down*.

Then I found `Microsoft.Maui.Internals.WeakList<T>`, which I did not
like quite as much as my implementation. I deleted/replaced its usage
adding new unit tests for `WeakList<T>`.

Note that I believe I found one other leak, so this doesn't fully
solve #12039 yet.

* [create-pull-request] automated change (#13306)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* [controls] one less WeakReference in TypedBinding (#13304)

Context: https://github.com/Vroomer/MAUI-master-detail-memory-leak
Context: #12039

When reviewing the memory snapshots in #12039, I noticed a
`WeakReference<T>` that could be completely removed in `TypedBinding`.
`BindingExpression.WeakPropertyChangedProxy` already had this exposed
as a `Source` property we can just use instead.

I also updated some `TypedBindingUnitTests` to assert more things are
GC'd properly.

I don't think this fixes an issue, except saving ~8 bytes per
`TypedBinding` and makes memory snapshots smaller/easier to read.

* Update Essentials API Docs Misc (#12996)

* Update Essentials API Docs Misc

* Some more

* Placemark

* PlacemarkExtensions

* SensorSpeed

* UnitConverters

* Delete UnitConverters.xml

* Apple Sign In

* WebAuthenticator

* Some more

* Update src/Essentials/src/FileSystem/FileSystem.shared.cs

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Apply suggestions from code review

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* Obsolete some of the AutomationProperties (#13104)

* Obsolete some of the AutomationProperties

* Update SemanticProperties.cs

* [Resizetizer] Do not update images if they have not been updated. (#13224)

* [Resizetizer] Do not update images if they have not been updated.

Rather than generating the images on every build we should
check to see if the source has changed before calling the
expensive generation processes. This seems to take about 150-200ms
off an incremental build when only one image file was changed.

* Added Unit Tests. Added support for iOS and Windows

* Updated based on feedback

* Rework

* Rework

* Thank you for your pull request. We are auto-formating your source code to follow our code guidelines.

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>

* [Windows] Fix crash on Windows WebView updating the Html Source more than once (#13222)

* Fix crash on Windows WebView updating the Html Source more than once

* Fixed build error

* Update src/Core/src/Platform/Windows/WebViewExtensions.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* Update dependencies from https://github.com/xamarin/xamarin-android build main-7c42c60d587ad4544a5ee326adfa8b1d23f72204-1 (#13316)

Microsoft.Android.Sdk.Windows
 From Version 34.0.0-preview.2.149 -> To Version 34.0.0-preview.2.151

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

* [core] WeakEventManager.RemoveEventHandler() should clear subscriptions (#13333)

* [core] WeakEventManager.RemoveEventHandler() should clear subscriptions

Context: #12039
Context: https://github.com/Vroomer/MAUI-master-detail-memory-leak
Context: https://github.com/symbiogenesis/Maui.DataGrid/tree/memory-leak

Reviewing memory snapshots in the above apps, sometimes I would see
new `WeakEventManager+Subscription` objects be created and never go
away.

I noticed the `WeakEventManager.RemoveEventHandler()` method did not
remove any `Subscription` entries that it encountered were no longer
alive.

I could reproduce this problem in a test, and improved an existing
test to check this collection is cleared appropriately:

    readonly Dictionary<string, List<Subscription>> _eventHandlers = new();

* Remove the `n - 1` business

This is closer to the standard `forr` snippet that has been around forever, just using `n` instead of `i`.

* reduce duplicate IndexOf calls (#12599)

* Auto-format source code

* [create-pull-request] automated change (#13337)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* [main] Update dependencies from dotnet/xharness (#11867)

* Update dependencies from https://github.com/dotnet/xharness build 20221128.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.22578.1

* Update default dotner version installed

* Update dependencies from https://github.com/dotnet/xharness build 20221207.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.22607.1

* Update versions to try again

* MicrosoftDotnetSdkInternalPackageVersion

* Try stable feed

* Extensions version back

* Don t bump version

* Update dependencies from https://github.com/dotnet/xharness build 20221215.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.22615.1

* Update dependencies from https://github.com/dotnet/xharness build 20221220.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.22620.1

* Update dependencies from https://github.com/dotnet/xharness build 20230102.2

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.23052.2

* Update dependencies from https://github.com/dotnet/xharness build 20230109.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.23059.1

* Update dependencies from https://github.com/dotnet/xharness build 20230118.2

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.23068.2

* Update dependencies from https://github.com/dotnet/xharness build 20230123.2

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.23073.2

* Update dependencies from https://github.com/dotnet/xharness build 20230202.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.23102.1

* Update dependencies from https://github.com/dotnet/xharness build 20230210.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22569.1 -> To Version 1.0.0-prerelease.23110.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>

* ItemContentControl - apply bindings once for ItemTemplate (Windows) (#10999)

* avoid setting bindings twice

* add sample code for testing purposes

* [Android] Don't lose the padding when background is set (#13301) fixes #12224

* [Android] Don't lose the padding when background is set

* Auto-format source code

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>

* Fix setting bottom tab icon title (#12889) Fixes #12105

* Don't reset entire menu when icon/title changes

* Auto-format source code

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>

* Fix install .net

* [macOS] Fix crash using Shell SearchHandler on Catalyst (#11926)

* Fix crash using Shell SearchHandler on Catalyst

* Updated changes

* Added device test

* Update src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/UIContainerCell.cs

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

* Fix merge issue

* Moved test

---------

Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>

* Finalize Essentials API Docs (#13320)

* Final docs + WarningsAsErrors on Missing Docs

* Delete all unused XML files

* Update Permissions.tizen.cs

* [iOS] Fix sizing of button when using CharacterSpacing (#13250) Fixes #10293

* [iOS] Set the attributed title on the button and not the inner label

* Just small cleanup on this file

* Reinstate test fix

---------

Co-authored-by: E.Z. Hart <hartez@gmail.com>

* fix(ShellView): Fixed an issue in `ShellView` where items added via code would be duplicated (#13326)

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

* Changes in project template to avoid BoxView mistake (#13348)

* Bump coverlet.collector from 3.1.2 to 3.2.0 (#13359)

Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 3.1.2 to 3.2.0.
- [Release notes](https://github.com/coverlet-coverage/coverlet/releases)
- [Commits](https://github.com/coverlet-coverage/coverlet/commits/v3.2.0)

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump Microsoft.AspNetCore.Authorization from 7.0.2 to 7.0.3 (#13350)

* Bump Microsoft.AspNetCore.Authorization from 7.0.2 to 7.0.3

Bumps [Microsoft.AspNetCore.Authorization](https://github.com/dotnet/aspnetcore) from 7.0.2 to 7.0.3.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.2...v7.0.3)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Authorization
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Move other packages for 7.0.3

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>

* Update dependencies from https://github.com/xamarin/xamarin-android build main-aa54ed3d57d7c54095b869c1c0c3a7d7e4761d85-1 (#13360)

Microsoft.Android.Sdk.Windows
 From Version 34.0.0-preview.2.151 -> To Version 34.0.0-preview.2.152

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

* [Windows] Fix crash using complex html content (#11409)

* Fix crash using complex html content on Windows

* Use device test in all the platforms

* [CI] Enure the pwsh is in the right dir. (#13370)

Follow up of #13264

We need to be sure that the pwsh is executed from the right dir, the
simplest way is to set the working dir for the step.

* [create-pull-request] automated change (#13373)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Added pending changes in Android AlertManager (#11989)

* Update dotnet-autoformat-pr-push.yml (#13390)

* Ensure OnMeasure always calls SetMeasuredDimension in ShellPageContainer (#13153) Fixes #13152

* At a minimum, call the base method

* Copy pattern from elsewhere in MAUI

* Implement requested changes

* Clarify test (#13363)

* Clarify test

* - fix spelling

* Bump Microsoft.Web.WebView2 from 1.0.1518.46 to 1.0.1587.40 (#13389)

Bumps Microsoft.Web.WebView2 from 1.0.1518.46 to 1.0.1587.40.

---
updated-dependencies:
- dependency-name: Microsoft.Web.WebView2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Android] Fix crash adding items to CollectionView on navigating (#13385) Fixes #12219

* Fix crash adding items to CollectionView on Android navigating

* Changes in test

* [iOS/MacCatalyst] Fix Editor scrolling (#13234)

* [iOS] Don't update the offset if there's no space available

* [iOS] Use the MauiLabel to set a label with insets

Using the constrains was keeping the UITextView from scrolling

* [Windows] Fix Shell FlyoutBackground property (#13132)

* Fix issue using Shell FlyoutBackground on Windows

* Changes based on PR feedback

* Changes based on PR feedback

* Updated test

* Update src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Windows.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* Add missing ;

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* [core] fix memory leaks in bindings (#13327)

Fixes: #12039
Fixes: #10560
Context: https://github.com/Vroomer/MAUI-master-detail-memory-leak
Context: https://github.com/symbiogenesis/Maui.DataGrid/tree/memory-leak

In investigating various MAUI samples, I found the following object
leaking:

    WeakPropertyChangedProxy (referenced by ->)
        TypedBinding
        Binding

In ~2016, I contributed a fix to Xamarin.Forms:

xamarin/Xamarin.Forms@f6febd4

Back then, this solved the follow case:

1. You have a long-lived `ViewModel` class. Could be a singleton, etc.

2. Data-bind a `View` to this `ViewModel`.

3. The `ViewModel` indefinitely held on to any object that subscribed
   to `PropertyChanged`.

At the time, this solved a huge memory leak, because a data-bound
`View` would have a reference to its parent, then to its parent, etc.
Effectively this was leaking entire `Page`'s at the time.

Unfortunately, there was still a flaw in this change...
`WeakPropertyChangedProxy` hangs around forever instead! I could
reproduce this problem in unit tests, by accessing various internal
members through reflection -- asserting they were alive or not.

We do have another layer of indirection, where other objects are GC'd
that can free the `WeakPropertyChangedProxy`, such as:

    // Regular Binding
    ~BindingExpressionPart() => _listener?.Unsubscribe();
    // TypedBinding
    ~PropertyChangedProxy() => Listener?.Unsubscribe();

This means it would take two GC's for these objects to go away, but it
is better than the alternative -- they *can* actually go away now.

After testing apps with this change, sometimes I would get an
`InvalidOperationException` in `WeakReference<T>`:

https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/WeakReference.T.cs,103

So I added a parameter to `Unsubscribe(finalizer: true)`, to skip
`WeakReference<T>.SetTarget()` from finalizers.

After this change, I still found an issue! In my new unit test, the
following would hold onto a `ViemModel` object forever:

    VisualElement.BackgroundProperty.DefaultValue

This held the value of `Brush.Default`, in which
`Brush.Default.BindingContext` was the `ViewModel`!

My first thought was for `Brush.Default` to return `ImmutableBrush`:

    public static Brush Default => defaultBrush ??= new ImmutableBrush(null);

Because anyone could do `Brush.Default.Color = Colors.Red` if they liked.

When this didn't fix it, I found the underlying `_inheritedContext` is
what held a reference to my `ViewModel` object. I changed this value
to a `WeakReference`.

The types of leaks this fixes:

* Bindings to application-lifetime, singleton `ViewModel`s

* Scrolling `CollectionView`, `ListView`, etc. with data-bindings.

* Styles that were used on a `View` or `Page` that is now removed from
  the screen via navigation, de-parenting, etc.

Ok, I really think the leaks are gone now. Maybe?

* [CI] Fix more paths in the packs.yml to work with the unified pipeline.

* [CI] Fix the step to copy the metadata.

* Auto-format source code

* Add implicit package reference for Compat (#13427)

Ultimately we want this to be an implicit reference which is not included by default and opt-in, however visual studio's Live Visual tree currently depends on the assembly existing and being loaded so we cannot yet remove it.

The default property assignment can be removed once VS is ready for this.

* Add shell pages via controller instead of handler (#13332)

* Add shell pages via controller instead of handler

* Auto-format source code

* - cleanup

* - add wait

* - push test into modal to isolate better

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>

* Use and clear a local nuget cache (#13256)

* Use and clear a local nuget cache

* more

* Have Frame use MinimumHeight/Width for minimums instead of constraints (#13336)

* Have Frame use MinimumHeight/Width for minimums instead of constraints
Fixes #13074

* Auto-format source code

* Adjust test for other screen sizes/densities

* Update src/Controls/src/Core/Compatibility/Handlers/Android/FrameRenderer.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

* Make legacy min Frame size a constant

* Auto-format source code

* Make Frame test less awkward

* Auto-format source code

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
Co-authored-by: Janus Weil <janus@gcc.gnu.org>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Lutz Roeder <lutzroeder@users.noreply.github.com>
Co-authored-by: Fabian <f.becker33@outlook.de>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Konstantin S <havendv@gmail.com>
Co-authored-by: E.Z. Hart <hartez@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Andrés Giudici <agiudici@gmail.com>
Co-authored-by: Andrés Giudici <agiudici@tpssa.com.ar>
Co-authored-by: Adrian Hall <photoadrian@outlook.com>
Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Peter Collins <pecolli@microsoft.com>
Co-authored-by: Espen Røvik Larsen <espenrl@users.noreply.github.com>
Co-authored-by: Rachel Kang <rachelkang@microsoft.com>
Co-authored-by: vividos <michael.fink@asamnet.de>
Co-authored-by: Dean Ellis <dellis1972@googlemail.com>
Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
Co-authored-by: Trivalik <3148279+trivalik@users.noreply.github.com>
Co-authored-by: E.Z. Hart <hartez@gmail.com>
Co-authored-by: Mike Corsaro <corsarom@gmail.com>
Co-authored-by: Mike Corsaro <mikecorsaro@microsoft.com>
Co-authored-by: Nicholas Bauer <nicholasbauer@outlook.com>
mattleibow added a commit that referenced this pull request Mar 31, 2023
### Description

Backport of #11206

This change moves most - if not all - the logic, assemblies, build tasks, targets and props into NuGet packages. This allows .NET MAUI to be usable without having to care about what version of the workload is installed.

There are still a few things - mostly the automagic and Windows fixes - in the workload pack, but this is probably temporary and/or non-essential for the working of the build. Things like the project capabilities are still in the workload as this is needed for the IDE and cannot be in NuGet packages.

Everything else is now inside a NuGet package that can be upgraded, pinned and otherwise used without requiring VS to have installed the workload to match. There is the benefit of the NuGet packages being installed on disk and thus reducing/removing the need to download. But that is minimal now since we have smaller and fewer packages.
# Conflicts:
#	eng/Versions.props
#	src/Controls/Foldable/src/Controls.Foldable.csproj
#	src/Controls/Maps/src/Controls.Maps.csproj
#	src/Controls/src/Core/Controls.Core.csproj
#	src/Controls/src/SourceGen/Controls.SourceGen.csproj
#	src/Controls/src/Xaml.Design/Controls.Xaml.Design.csproj
#	src/Core/maps/src/Maps.csproj
#	src/Maui.InTree.targets
#	src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-setup Installation, setup, requirements, maui-check, workloads, platform support partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants