Skip to content

Conversation

@jonpryor
Copy link
Contributor

@jonpryor jonpryor commented Nov 4, 2025

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.GetNames<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.

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:

Other information ℹ️

@github-actions github-actions bot added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform area/automation Categorizes an issue or PR as relevant to project automation platform/x11 🐧 Categorizes an issue or PR as relevant to X11 labels Nov 4, 2025
@jonpryor jonpryor force-pushed the dev/jonpryor/jonp-fix-IL3050-Enum.GetValues branch from be93926 to f2b57a4 Compare November 4, 2025 17:41
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21746/docs/index.html

@unodevops
Copy link
Contributor

🤖 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

@unodevops
Copy link
Contributor

🤖 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.
@jonpryor jonpryor force-pushed the dev/jonpryor/jonp-fix-IL3050-Enum.GetValues branch from f2b57a4 to 29f5236 Compare November 4, 2025 19:05
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21746/docs/index.html

@unodevops
Copy link
Contributor

🤖 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

@unodevops
Copy link
Contributor

⚠️⚠️ The build 180925 has failed on Uno.UI - CI.

@nventive-devops
Copy link
Contributor

The build 180925 found UI Test snapshots differences: android-28-net9: 17, android-28-net9-Snap: 30, ios: 6, ios-Snap: 56, skia-linux-screenshots: 61, skia-windows-screenshots: 433, wasm: 105, wasm-automated-net10.0-WinUI-Benchmarks-automated: 0, wasm-automated-net10.0-WinUI-Default-automated: 8, wasm-automated-net10.0-WinUI-RuntimeTests-0: 0, wasm-automated-net10.0-WinUI-RuntimeTests-1: 0, wasm-automated-net10.0-WinUI-RuntimeTests-2: 0

Details
  • android-28-net9: 17 changed over 825

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • FlyoutTest_When_NoOverlayInputPassThroughElement_Then_DontPassThrough_woOff_UITests_Shared_Windows_UI_Xaml_Controls_Flyout_Flyout_OverlayInputPassThroughElement
    • ListView_ListViewWithHeader_InitializesTest_SamplesApp_Windows_UI_Xaml_Controls_ListView_HorizontalListViewGrouped
    • Popup_PlacementTest_2Default_HTVL_Uno_UI_Samples_Content_UITests_Popup_Popup_HVAlignments
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • When_ExtendedSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • WebView_NavigateToAnchor_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation
    • When_Parent_PointerMoved_After_drag_on_non-scrolling_ScrollViewer
    • When_Parent_PointerMoved_After_drag_on_ScrollViewer_-_touch
    • When_SingleSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • NativeCommandBar_Size_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Dynamic
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • Detereminate_ProgressRing_Validation75_[#FF0000_#008000_#008000_#008000]_Progress-Ring-Value-75
    • UpDownEnabledTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Detereminate_ProgressRing_Validation50_[#FF0000_#008000_#008000_#FF0000]_Progress-Ring-Value-50
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
  • android-28-net9-Snap: 30 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • TeachingTip_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage
    • SwipeControl_MUXControlsTestApp_SwipeControlPage2_MUXControlsTestApp_SwipeControlPage2
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavOnlyPage_MUXControlsTestApp_NavigationViewTopNavOnlyPage
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavPage_MUXControlsTestApp_NavigationViewTopNavPage
    • NavigationView_MUXControlsTestApp_NavigationViewRS4Page_MUXControlsTestApp_NavigationViewRS4Page
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • Scrolling_MUXControlsTestApp_ScrollViewDynamicPage_MUXControlsTestApp_ScrollViewDynamicPage
    • CommandBar_Examples_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Examples
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_FromMsAppData_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_FromMsAppData
    • CommandBarFlyout_MUXControlsTestApp_CommandBarFlyoutPage_MUXControlsTestApp_CommandBarFlyoutPage
    • ListView_ListViewSelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • MUX_NumberBox_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • TabView_MUXControlsTestApp_TabViewPage_MUXControlsTestApp_TabViewPage
    • RatingControl_UITests_Microsoft_UI_Xaml_Controls_RatingControlTests_RatingControlPage_UITests_Microsoft_UI_Xaml_Controls_RatingControlTests_RatingControlPage
    • Icons_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground
    • WebView_WebView2_JavascriptInvoke_SamplesApp_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_JavascriptInvoke
    • Windows_Media_MediaPlayer_UITests_Windows_Media_MediaPlayerTests
    • Brushes_Uno_UI_Samples_UITests_ImageBrushTestControl_Ellipse_Uno_UI_Samples_UITests_ImageBrushTestControl_Ellipse
    • NavigationView_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage
    • TextBlock_UITests_Shared_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_Layout_UITests_Shared_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_Layout
  • ios: 6 changed over 255

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Validate_Offscreen_Shapes_UITests_Windows_UI_Xaml_Shapes_Offscreen_Shapes
    • ListView_ExpandableItem_ExpandSingleItem_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListView_Expandable_Item
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • When_TextSize_Then_RelativeSize_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_RelativeTextSize
  • ios-Snap: 56 changed over 993

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Brushes_PanelImageBrush_Uno_UI_Samples_UITests_ImageBrushTestControl_PanelImageBrush
    • Brushes_ImageBrushStretch_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushStretch
    • Flyouts_UITests_Windows_UI_Xaml_Controls_Flyout_Flyout_TemplatedParent_UITests_Windows_UI_Xaml_Controls_Flyout_Flyout_TemplatedParent
    • Grid_Grid_DataBound_ColumnRow_Definitions_Uno_UI_Samples_Content_UITests_GridTestsControl_Grid_DataBound_ColumnRow_Definitions
    • Icons_UITests_Microsoft_UI_Xaml_Controls_ImageIconTests_ImageIconPage_UITests_Microsoft_UI_Xaml_Controls_ImageIconTests_ImageIconPage
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Equal_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Equal
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Smaller_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Smaller
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Taller_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Taller
    • NavigationView_MUXControlsTestApp_NavigationViewStretchPage_MUXControlsTestApp_NavigationViewStretchPage
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavPage_MUXControlsTestApp_NavigationViewTopNavPage
    • NavigationView_MUXControlsTestApp_NavigationViewMenuItemStretchPage_MUXControlsTestApp_NavigationViewMenuItemStretchPage
    • PagerControl_UITests_Microsoft_UI_Xaml_Controls_PagerControlTests_PagerControlPage_UITests_Microsoft_UI_Xaml_Controls_PagerControlTests_PagerControlPage
    • RatingControl_UITests_Microsoft_UI_Xaml_Controls_RatingControlTests_RatingControlPage_UITests_Microsoft_UI_Xaml_Controls_RatingControlTests_RatingControlPage
    • Performance_UITests_Windows_UI_Xaml_Performance_Performance_1000ButtonsContinuousRendering_UITests_Windows_UI_Xaml_Performance_Performance_1000ButtonsContinuousRendering
    • TextBlock_TextBlockMultilineInStarStackPanel_Uno_UI_Samples_Content_UITests_TextBlockControl_TextBlockMultilineInStarStackPanel
    • TextBox_TextBox_WithPadding_Focus_UITests_Windows_UI_Xaml_Controls_TextBox_TextBox_WithPadding_Focus
    • MediaPlayerElement_Using_3gp_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_3gp_Extension
    • Brushes_ImageBrushStretch2_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushStretch2
    • Brushes_Uno_UI_Samples_UITests_ImageBrushTestControl_Ellipse_Uno_UI_Samples_UITests_ImageBrushTestControl_Ellipse
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats
  • skia-linux-screenshots: 61 changed over 2302

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ButtonClippingTestsControl.png-dark
    • Gamepad_CurrentReading.png-dark
    • CalendarView_Theming.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • BitmapIcon_Monochromatic.png
    • DropDownButtonPage.png-dark
    • Examples.png-dark
    • Examples.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • CalendarView_Theming.png
    • DisplayInformation.png-dark
    • DoubleImageBrushInList.png-dark
  • skia-windows-screenshots: 433 changed over 2302

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarButtonTest.png
    • AppBarToggleButtonTest.png-dark
    • Attributed_text_Simple.png-dark
    • Attributed_text_Simple.png
    • BackGesture.png
    • Border_With_TranslateTransform.png-dark
    • Border_With_TranslateTransform.png
    • ComboBox_SelectedIndex.png-dark
    • ComboBox_SelectedIndex.png
    • DoubleAnimation_Cumulative.png-dark
    • DoubleAnimation_Cumulative.png
    • DoubleAnimation_Opacity_TextBlock.png-dark
    • DoubleAnimation_Opacity_TextBlock.png
    • AppBarButtonWithIconTest.png-dark
    • Attributed_text_FontSize_Changing.png-dark
    • Attributed_text_FontSize_Changing.png
    • AutoSizedTopLeft.png-dark
    • AutoSizedTopLeft.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
  • wasm: 105 changed over 1057

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • GenericApp.Views.Samples.Shared.Content.UITests.GridViewMultipleSelectionMode
    • initial_state
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewHeaderFooter_ImplicitlyBinded
    • UITests.Shared.Windows_UI_Xaml_Controls.ListView.ListView_ChangeView
    • UITests.Shared.Windows_UI_Xaml_Controls.ListView.ListView_DataContext_Propagation
    • UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests.TextBox_Selection
    • UITests.Windows_UI_Xaml_Controls.ImageTests.SvgImageSource_MultiLoad
    • UITests.Windows_UI_Xaml_Controls.UIElementCollectionTests.UIElementCollection_Insert
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewLegacy
    • UITests.Shared.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigateToString2
    • UITests.Shared.Windows_UI_Xaml_Controls.TextBlockControl.SimpleText_MaxLines_Different_Font_Size
    • UITests.Windows_UI_Xaml_Controls.BorderTests.BorderWithNullBrushAndNonZeroThickness
    • UITests.Windows_UI_Xaml_Media.GradientBrushTests.GradientsPage
    • SamplesApp.Windows_UI_Xaml_Shapes.PathTestsControl.Path_Arc
    • UITests.Microsoft_UI_Xaml_Controls.CommandBarTests.CommandBar_Primary_And_Secondary
    • UITests.Shared.Windows_UI_Xaml_Controls.ToggleSwitchControl.ToggleSwitchUnloadReload
    • UITests.Windows_UI_Xaml_Controls.TextBox.TextBox_Focus_Programmatic
    • UITests.Microsoft_UI_Xaml_Controls.TreeView.TreeViewBasics
    • UITests.Microsoft_UI_Xaml_Controls.TreeViewTests.TreeView_ItemInvoked
    • UITests.Shared.Windows_UI_Xaml_Controls.ComboBox.ComboBox_ComboBoxItem_Selection
  • wasm-automated-net10.0-WinUI-Benchmarks-automated: 0 changed over 1

  • wasm-automated-net10.0-WinUI-Default-automated: 8 changed over 877

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • Default_StrokeThickness_MyRect
    • Default_StrokeThickness_MyPolyline
    • When_MultipleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Default_StrokeThickness_MyPath
    • Default_StrokeThickness_MyPolygon
    • Default_StrokeThickness_MyEllipse
    • TestProgressRing_InitialState_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
  • wasm-automated-net10.0-WinUI-RuntimeTests-0: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-1: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-2: 0 changed over 1

@jonpryor jonpryor enabled auto-merge November 5, 2025 12:58
@jonpryor jonpryor requested a review from ramezgerges November 5, 2025 12:58
@jonpryor jonpryor merged commit 08c99a7 into master Nov 5, 2025
107 checks passed
@jonpryor jonpryor deleted the dev/jonpryor/jonp-fix-IL3050-Enum.GetValues branch November 5, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform platform/x11 🐧 Categorizes an issue or PR as relevant to X11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants