-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[build] make TrimMode=full
function like NativeAOT
#22282
Conversation
Context: dotnet/android#8805 Context: xamarin/xamarin-macios#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`.
@simonrozsival it seems like this found a single warning:
Is this different behavior than NativeAOT? |
See if this fixes trimmer
I guess
I will probably exclude |
It is weird that we didn't see the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should look into the Blazor warnings separately, these warnings are coming from a different repository (https://github.com/dotnet/aspnetcore).
Context: dotnet/android#8805
Context: xamarin/xamarin-macios#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: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 whenTrimMode=full
is used. Developers can also adjust these settings and respond to trimmer warnings in their own code.I also updated
RunOnAndroid
andRunOniOS
tests to verify that project templates launch successfully withTrimMode=full
.