-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[net8.0] Merge main to net8.0 #17284
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes: #11467 Context: https://github.com/maiia-kuzmishyna/MAUI-ProtectedEventHandlers Reviewing the customer sample, it appears to be a valid case. Consider a `ChildButton` defined in XAML: <local:ParentButton xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:foo" x:Class="foo.ChildButton"> </local:ParentButton> Where `ParentButton` is also defined in XAML: <Button xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="foo.ParentButton" Clicked="ParentButton_OnClicked"> </Button> Where `ParentButton_OnClicked` is of course private: private void ParentButton_OnClicked(object sender, EventArgs e) { } Throws an exception at runtime with: No method ParentButton_OnClicked with correct signature found on type foo.ChildButton What was also odd, it appears the problem just "goes away" in Release mode, meaning it works under XamlC. This kind of points to a bug with non-compiled XAML. It appears the problem was the code: foreach (var mi in rootElement.GetType().GetRuntimeMethods()) { //... if (mi.Name == (string)value) { addMethod.Invoke(element, new[] { mi.CreateDelegate(eventInfo.EventHandlerType, mi.IsStatic ? null : rootElement) }); return true; } //... } In this example, `rootElement` is of type `ChildButton` while the method is on type `ParentButton`. As mentioned on: https://stackoverflow.com/a/2267299 You need to access `Type.BaseType` to find private methods on base types. I changed this to instead: * Iterate over `rootElement.GetType()` and its base types. * Call `Type.GetMethod()` using the method name, passing the appropriate `BindingFlags`. This appears to make the new test pass, solving the issue.
Fixes #11467 Context: https://github.com/maiia-kuzmishyna/MAUI-ProtectedEventHandlers Reviewing the customer sample, it appears to be a valid case. Consider a `ChildButton` defined in XAML: <local:ParentButton xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:foo" x:Class="foo.ChildButton"> </local:ParentButton> Where `ParentButton` is also defined in XAML: <Button xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="foo.ParentButton" Clicked="ParentButton_OnClicked"> </Button> Where `ParentButton_OnClicked` is of course private: private void ParentButton_OnClicked(object sender, EventArgs e) { } Throws an exception at runtime with: No method ParentButton_OnClicked with correct signature found on type foo.ChildButton What was also odd, it appears the problem just "goes away" in Release mode, meaning it works under XamlC. This kind of points to a bug with non-compiled XAML. It appears the problem was the code: foreach (var mi in rootElement.GetType().GetRuntimeMethods()) { //... if (mi.Name == (string)value) { addMethod.Invoke(element, new[] { mi.CreateDelegate(eventInfo.EventHandlerType, mi.IsStatic ? null : rootElement) }); return true; } //... } In this example, `rootElement` is of type `ChildButton` while the method is on type `ParentButton`. As mentioned on: https://stackoverflow.com/a/2267299 You need to access `Type.BaseType` to find private methods on base types. I changed this to instead: * Iterate over `rootElement.GetType()` and its base types. * Call `Type.GetMethod()` using the method name, passing the appropriate `BindingFlags`. This appears to make the new test pass, solving the issue.
…30831.1 (#17196) Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit From Version 8.0.0-prerelease.23421.1 -> To Version 8.0.0-prerelease.23431.1 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
* Make ViewHandlerConverter use apps MauiContext Tentative change * Improve comment * Fix render issue from logical child perspective * Add UI test * Only clear items in the ItemSource We only cant to remove chlidren that are inside the items. * Address PR feedback * Bandaid fix android tests * Add missing link * Simplify code * Fix merge conflicts * Newline nit
* [docs] Document View * Apply suggestions from code review Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> * More PR feedback --------- Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
* Remove need for MapMenuItems flag to sync selected item Co-authored-by: Mike Corsaro <mikecorsaro@microsoft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Context: https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management Fixes: #12953 @mattleibow has already made a few changes to improve this scenario, by introducing `$(DisableMauiImplicitPackageReferences)`. I think the main thing missing is to change default values when `$(ManagePackageVersionsCentrally)` is true. This setting, that enables CPM, should automatically turn off all implicit `@(PackageReference)`. I renamed `$(EnableMauiImplicitPackageReferences)` to `$(DisableMauiImplicitPackageReferences)` to better align with the changes we made in MAUI in .NET 7 for a future servicing release: #17046 I tested these changes in a sample application here: hypdeb/repros@master...jonathanpeppers:MauiNuGetCPMRepro:peppers I also updated `Workload/README.md` to have a section showing how to setup NuGet CPM.
* Copy Windows assets to the output folder for Unpackaged ## Description I noticed that when publishing unpackaged apps, the content was not copied to the publish folder. This PR makes sure we indicate that we want to do this. MSIX apps automatically know to copy it, but unpackaged follows the default .NET SDK rules and requires more instructions. * Update BaseBuildTest.cs * Update TemplateTests.cs * Update DotnetInternal.cs
* Fix Tab Colors on iOS * Added device tests * Fix the build * Fix the test * Updated tests * Fix mistakes from merge * Fix the build * - fix up tests to better represent state * - cleanup and enable tabbedpage tests for all platforms * - fix tests for bottom navigation view * - fix iOS tests * Update TabbedPageTests.cs * - fixup tests * - fix winui coloring --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
I've been working to get back some of our lost startup performance on Android in .NET MAUI. We are really close, a few changes will get .NET 8 on par or faster than .NET 7. Profiling startup of a `dotnet new maui` app on a Pixel 5, `dotnet-trace` reported time spent in: 16.62ms microsoft.maui.controls!Microsoft.Maui.Controls.Platform.ToolbarExtensions.UpdateIconColor( If you drill in further in this method, you can see the time spent in: 10.19ms xamarin.androidx.appcompat!AndroidX.AppCompat.Widget.Toolbar.get_OverflowIcon() 6.42ms microsoft.maui!Microsoft.Maui.Platform.DrawableExtensions.SetColorFilter() The project template doesn't even display a `Toolbar` icon, but it looks like there are some straightforward performance wins here. In 9b091fd, accessing `OverflowIcon` was introduced to fix the color of the overflow icon. This code had the pattern: if (navIconColor != null && nativeToolbar.OverflowIcon != null) { nativeToolbar.OverflowIcon.SetColorFilter(navIconColor, FilterMode.SrcAtop); } This accesses `OverflowIcon` twice, where we can use pattern matching instead to avoid this. Additionally, `SetColorFilter` appears to be called in a couple places throughout .NET MAUI, we can move most of its logic to Java to avoid interop. So for example: switch (mode) { case FilterMode.SrcIn: return BlendMode.SrcIn; case FilterMode.Multiply: return BlendMode.Multiply; case FilterMode.SrcAtop: return BlendMode.SrcAtop; } `Enum` values are just classes in Java, so this calling a Java method from C# that returns an object. We then have to do various bookkeeping around handling this Java object instance in C#. Then the other call, also does Java interop for `BlendModeColorFilter`'s constructor and the `SetColorFilter()`: drawable.SetColorFilter(new BlendModeColorFilter(color, filterMode29)); By moving this logic to Java, we can instead call: PlatformInterop.SetColorFilter(drawable, color, (int)mode); We also do the API Q/29 platform checks on the Java side. With these changes in place, the three methods above are improved: 6.19ms microsoft.maui.controls!Microsoft.Maui.Controls.Platform.ToolbarExtensions.UpdateIconColor() 3.87ms xamarin.androidx.appcompat!AndroidX.AppCompat.Widget.Toolbar.get_OverflowIcon() 1.15ms microsoft.maui!Microsoft.Maui.Platform.DrawableExtensions.SetColorFilter() I would estimate these changes improve startup by about ~10ms on a Pixel 5, seeing the savings on the topmost method, `UpdateIconColor()`.
* Enable Mac Catalyst Core Device Tests in CI * Enable CI run for Core tests * Fix not finding NSWindow in headless scenario * Update AssertionExtensions.iOS.cs * Update SearchBarHandlerTests.cs
Co-authored-by: Mike Corsaro <mikecorsaro@microsoft.com>
…7277) * Stronger Type for RoutedEventArg property * change type name --------- Co-authored-by: TJ Lambert (HE/HIM/HIS) <antlambe@microsoft.com>
Bumps [NUnit3TestAdapter](https://github.com/nunit/nunit3-vs-adapter) from 4.4.2 to 4.5.0. - [Release notes](https://github.com/nunit/nunit3-vs-adapter/releases) - [Commits](nunit/nunit3-vs-adapter@V4.4.2...V4.5.0) --- updated-dependencies: - dependency-name: NUnit3TestAdapter 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>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# Conflicts: # src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
PureWeen
approved these changes
Sep 11, 2023
mattleibow
approved these changes
Sep 11, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
Bring latest changes from main to net8.0