Open jonathanpeppers opened 1 week ago
Ok wow MAUI Integration
test lane will fail with:
D:\a\_work\1\s\maui\src\Core\src\Handlers\HybridWebView\HybridWebViewHandler.Android.cs(50,5): error IL2026: Using member 'Java.Interop.ExportAttribute.ExportAttribute(String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. [ExportAttribute] uses dynamic features. [D:\a\_work\1\s\maui\src\Core\src\Core.csproj::TargetFramework=net9.0-android35.0]
68 Warning(s)
1 Error(s)
Until we get this one:
The entire
Mono.Android.Export.dll
assembly is not trimming safe, and never will be: it relies on many dynamic features. But it is possible to get the warning:First, import
trim-analyzers.props
so we have the right analyzers set forMono.Android.Export.csproj
. We can also remove$(EnableSingleFileAnalyzer)
as it is intrim-analyzers.props
.This results in ~41 errors, which are mostly resolved by decorating every type with:
This seems simpler than decorating methods, as there are quite a few more methods involved than classes.
After this change, we are down to a handful of warnings:
This is a different analyzer for NativeAOT, which is IL3050.
The types involved are a smaller list, I decorated each with:
With these changes, there are no no warnings present any longer.
Other changes:
CodeAdd.cs
, it only contains a comment