-
Notifications
You must be signed in to change notification settings - Fork 832
fix(trimmer): Fix IL3050 warnings around Enum use #21746
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
Conversation
be93926 to
f2b57a4
Compare
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21746/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21746/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21746/docs/index.html |
When building `src/Uno.UI` with trimmer warnings enabled (and turned up to 11): dotnet build src/Uno.UI/Uno.UI.Skia.csproj -bl \ -p:TrimmerSingleWarn=false -p:_ExtraTrimmerArgs=--verbose -p:IsTrimmable=true -p:IsAotCompatible=true One of the warnings is: src/Uno.UI/UI/Xaml/Internal/InputManager.Pointers.ManagedDirectManip.cs(365,42): error IL3050: Using member 'System.Enum.GetValues(Type)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. It might not be possible to create an array of the enum type at runtime. Use the GetValues<TEnum> overload or the GetValuesAsUnderlyingType method instead. Replace use of `System.Enum` methods which take a `Type` parameter with their generic method overload: * `Enum.GetName(typeof(T), v)` becomes `Enum.GetName((T)v)` * `Enum.GetNames(typeof(T))` becomes `Enum.GetNames<T>()` * `Enum.GetValues(typeof(T))` becomes `Enum.GetValues<T>()` * `Enum.IsDefined(typeof(T), v)` becomes `Enum.IsDefined((T)v)` * `Enum.Parse(typeof(T), v)` becomes `Enum.Parse<T>(v)` This fixes the IL3050 warnings.
f2b57a4 to
29f5236
Compare
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21746/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21746/wasm-skia-net9/index.html |
|
|
|
The build 180925 found UI Test snapshots differences: Details
|
When building
src/Uno.UIwith trimmer warnings enabled (and turned up to 11):One of the warnings is:
Replace use of
System.Enummethods which take aTypeparameter with their generic method overload:Enum.GetName(typeof(T), v)becomesEnum.GetNames<T>(v)Enum.GetNames(typeof(T))becomesEnum.GetNames<T>()Enum.GetValues(typeof(T))becomesEnum.GetValues<T>()Enum.IsDefined(typeof(T), v)becomesEnum.IsDefined<T>(v)Enum.Parse(typeof(T), v)becomesEnum.Parse<T>(v)This fixes the IL3050 warnings.
GitHub Issue: closes #
PR Type:
What is the current behavior? 🤔
What is the new behavior? 🚀
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️