You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[tests] verify trimmer warnings where appropriate (#9076)
One change we need in the Android workload is to make sure that
trimmer warnings are displayed if a project sets `$(IsAotCompatible)`.
Customers would likely want this set for all platforms if they are
using NativeAOT on iOS or MacCatalyst.
I also wrote a test with somewhat complicated parameters to verify
we get warnings.
First, I can create a warning for both `IL2055` and `IL3050`:
// Member field
Type type = typeof (List<>);
// ...
// Later in OnCreate
Console.WriteLine (type.MakeGenericType (typeof (object)));
The combinations of tests are:
| Configuration | Property | Warning(s) |
| ------------- | ---------------------------------- | ----------------- |
| Debug | (defaults) | None |
| Release | (defaults) | None |
| Debug | TrimMode=full | None |
| Release | TrimMode=full | IL2055(2) |
| Release | SuppressTrimAnalysisWarnings=false | IL2055(2) |
| Debug | IsAotCompatible=true | IL2055, IL3050 |
| Release | IsAotCompatible=false | IL2055(2), IL3050 |
Some of the cases receive duplicate warnings, but this is expected as
the same behavior occurs in the simplest case:
* `dotnet new console`
* Add the above code to `Program.cs`
* `dotnet publish -c Release -r win-x64 -p:PublishAot=true`
* Receive warnings from both the Roslyn analyzer and ILC (NativeAOT compiler)
In a future PR, I might try to "fix" the duplicate warnings.
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@
85
85
<!-- For compat with user code not marked trimmable, only trim opt-in by default. -->
86
86
<TrimModeCondition=" '$(TrimMode)' == '' and '$(AndroidLinkMode)' == 'Full' ">full</TrimMode>
0 commit comments