* Juno: check in to lego/hb_7241b85a-f216-4d55-a9fa-d8030c736df5_20240925231640755. (#24935)
* Cleanup
* WIP: HybridWebView: Invoke .NET methods from JavaScript
* Cleanup
* WIP: Make Windows work end-to-end
* Start adding tests
* Improve tests
* Add Android
* iOS/MacCat
* Suppress
* Suppress
* Try un-rooting HybridWebViewHandler
* Use RuntimeFeature.IsDynamicCodeSupported
* Flip if
* Annotate differently
* Make InvokeJavaScriptType not an auto-property
Fixes:
ILC: IL2114: Microsoft.Maui.Controls.HybridWebView.<Microsoft.Maui.IHybridWebView.InvokeJavaScriptType>k__BackingField: 'DynamicallyAccessedMembersAttribute' on 'Microsoft.Maui.Controls.HybridWebView' or one of its base types
* Revert "Make InvokeJavaScriptType not an auto-property"
This reverts commit d8552206eb4a7f39bea3ac1c3d71ce9373e88338.
* Introduce Microsoft.Maui.RuntimeFeature.IsHybridWebViewSupported
* Update FeatureSwitches.md
* Fix [UnconditionalSuppressMessage] on Windows
* Missed a spot on Windows
* Seeing if `!RuntimeFeature` is an issue
* %(Trim) was inverted!
* Move [RUC] and [RDC] to types
* Only check RuntimeFeature.IsHybridWebViewSupported in one place
* Update MauiHybridWebView.cs
* Update HybridWebViewHandler.Windows.cs
* Duplicate `Microsoft.Maui.RuntimeFeature`
* Fix `_invokeJavaScriptType` field
* Expect 1 warning
---------
Co-authored-by: CSIGS@microsoft.com <csigs@users.noreply.github.com>
Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
* Add feature switch for compilation of bindings with source
* Add tests
* Improve binding context type mismatch error messages
* Enable compilation of bindings with source in tests
* Enable the feature switch in tests
* Fix propagating CompileBindingsWithSource via ILContext
* Added note to ignore device tests
* Update note for new devs, Added section on VerifyScreenshots, Explanation about AutomationId
* Removed Fixture Setup/Teardown
* Moved paragraphs around and added new subheadings to make it easier to read. Used correct formatting for class names. Removed GalleryPage content. Removed some redundant content.
* Added note about FailsOn attribute, elaborated on DeviceTests note
* Fixed spelling errors
* Alternate word
* Added back the bit about GalleryPage
* Fixed incorrect link for DeviceTests, added bit about Issue text
* Redid intro
* Added screenshots to the VerifyScreenshots section
* Removed section
* Added info about logging
* Fixed screenshot tags
* One more tag fix
* Fixed spelling, added some syntax formatting
* Addressed comments
* Changed links to permalinks
* Added pic of failed test screenshot
* Remove feature switch for XAML runtime parsing
* Suppress trim analysis errors in BindablePropertyConverter
* Fix warning code
* Suppress warning for getting the ObsoleteAttribute which might be removed by the trimmer
Context: https://github.com/xamarin/xamarin-android/pull/8805
Context: https://github.com/xamarin/xamarin-macios/pull/20354
In .NET 9, we want .NET MAUI applications to be able to use the
`TrimMode=full` option to remove unused code from the application:
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TrimMode>full</TrimMode>
</PropertyGroup>
With all the trimming work done to support NativeAOT, we should toggle
the same options when `TrimMode=full` is used:
* `MauiStrictXamlCompilation=true`
* `MauiXamlRuntimeParsingSupport=false`
* `MauiShellSearchResultsRendererDisplayMemberNameSupported=false`
* `MauiQueryPropertyAttributeSupport=false`
* `MauiImplicitCastOperatorsUsageViaReflectionSupport=false`
With these set, the `dotnet new maui` project template *should* have
zero trimmer warnings when `TrimMode=full` is used. Developers can also
adjust these settings and respond to trimmer warnings in their own code.
I also updated `RunOnAndroid` and `RunOniOS` tests to verify that
project templates launch successfully with `TrimMode=full`.
Note:
* Skip `maui-blazor` on iOS for now, as it contains trimmer warnings.
* Add feature switch
* Implement TypeConversionHelper
* Remove fixed warnings
* Make the new API public
* Extend the example in the docs
* Improve annotations
* Only use type converters when the feature flag is off
* Add runtime feature
* Annotate the QueryPropertyAttribute with RequiresUnreferencedCode
* Put application of QueryPropertyAttribute behind a feature switch
* Remove fixed warnings
* Update src/Controls/src/Core/TrimmerConstants.cs
Co-authored-by: Jonathan Peppers <jonathan.peppers@gmail.com>
---------
Co-authored-by: Jonathan Peppers <jonathan.peppers@gmail.com>
### 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.