Skip to content
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

fix(xamlreader): add proper support for markup-extension parsing #19185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Xiaoy312
Copy link
Contributor

@Xiaoy312 Xiaoy312 commented Jan 9, 2025

GitHub Issue (If applicable): closes #3399

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)

What is the current behavior?

What is the new behavior?

  • XamlReader fully supports dynamic parsing of custom MarkupExtension:
    • Markup's ProvideValue method will be evaluated and the return value will be insert in its document position.
    • an IXamlServiceProvider will be injected for ProvideValue(IXamlServiceProvider).
    • the -Extension suffix can be optionally omitted.

PR Checklist

Please check if your PR fulfills the following requirements:

@Xiaoy312 Xiaoy312 added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 9, 2025
@unodevops
Copy link
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19185/index.html

@unodevops
Copy link
Contributor

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

@unodevops
Copy link
Contributor

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

@Xiaoy312 Xiaoy312 force-pushed the dev/xygu/20250109/xamlreader-markup-support branch from 5c987de to c13dc02 Compare January 10, 2025 22:26
@Xiaoy312 Xiaoy312 requested a review from jeromelaban January 10, 2025 22:26
@Xiaoy312 Xiaoy312 marked this pull request as ready for review January 10, 2025 22:27
@unodevops
Copy link
Contributor

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

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19185/index.html

@unodevops
Copy link
Contributor

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

@Xiaoy312
Copy link
Contributor Author

The build 151666 has failed on Uno.UI - CI.
^ https://dev.azure.com/uno-platform/Uno%20Platform/_TestManagement/Runs?runId=3191371&_a=resultQuery
^ ListViewLegacy and ListViewMarginTest were failing due to timeout, and dont use any of xamlreader feature (just pure xaml page)

just retrying for now

@nventive-devops
Copy link
Contributor

The build 151666 found UI Test snapshots differences: android-28-net8: 22, android-28-net8-Snap: 41, ios: 7, ios-Snap: 45, skia-gtk-screenshots: 62, skia-linux-screenshots: 72, skia-windows-screenshots: 63, wasm: 243, wasm-automated-net9.0-UWP-Default-automated: 25, wasm-automated-net9.0-UWP-RuntimeTests-0: 0, wasm-automated-net9.0-UWP-RuntimeTests-1: 0, wasm-automated-net9.0-UWP-RuntimeTests-2: 0, wasm-automated-net9.0-WinUI-Benchmarks-automated: 0, wasm-automated-net9.0-WinUI-RuntimeTests-0: 0, wasm-automated-net9.0-WinUI-RuntimeTests-1: 0, wasm-automated-net9.0-WinUI-RuntimeTests-2: 0

Details
  • android-28-net8: 22 changed over 829

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • BasicExpressionTest_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_ExpressionTest
    • CheckBox_DoubleTapValidation_Uno_UI_Samples_Content_UITests_ButtonTestsControl_CheckBox_IsEnabled_Automated
    • DecimalFormatterTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • Detereminate_ProgressRing_Validation50_[#FF0000_#008000_#008000_#FF0000]_Progress-Ring-Value-50
    • DoesNotInterfereWithHorizontalDrag_UITests_Microsoft_UI_Xaml_Controls_RefreshContainerTests_RefreshContainerHorizontalScroll
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • When_Parent_PointerMoved_After_drag_on_ScrollViewer_-_touch
    • When_NoSelection_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Detereminate_ProgressRing_Validation25_[#FF0000_#008000_#FF0000_#FF0000]_Progress-Ring-Value-25
    • Pivot_Non_PivotItemChange_Validation_UITests_Shared_Windows_UI_Xaml_Controls_Pivot_Pivot_CustomContent_Automated
    • Pivot_Non_PivotItem_Items_UITests_Shared_Windows_UI_Xaml_Controls_Pivot_Pivot_CustomContent_Automated
    • When_Clipped_Rounded_Corners_UITests_Windows_UI_Xaml_Clipping_Clipping4273
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • WebView_NavigateToAnchor_Initial
    • Detereminate_ProgressRing_Validation75_[#FF0000_#008000_#008000_#008000]_Progress-Ring-Value-75
    • NativeCommandBar_Size_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Dynamic
    • NavigateBackAndForthBetweenMenuItemsAndSettings_Fluent_SamplesApp_Samples_Microsoft_UI_Xaml_Controls_NavigationViewTests_FluentStyle_FluentStyle_NavigationViewSample
  • android-28-net8-Snap: 41 changed over 1067

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Border_Border_Simple_with_non_Uniform_Thickness_Uno_UI_Samples_UITests_BorderTestsControl_Border_Simple_with_non_Uniform_Thickness
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • MediaPlayerElement_Sources_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Sources
    • Border_Border_Simple_No_Background_Uno_UI_Samples_UITests_BorderTestsControl_Border_Simple_No_Background
    • Border_Simple_with_Radius_Uno_UI_Samples_UITests_BorderTestsControl_Simple_with_Radius
    • Border_Uno_UI_Samples_UITests_BorderTestsControl_Border_BorderThickness_Uno_UI_Samples_UITests_BorderTestsControl_Border_BorderThickness
    • ColorPicker_ColorPickerSample_UITests_Microsoft_UI_Xaml_Controls_ColorPickerTests_ColorPickerSample
    • Border_BorderCenteredwithmargins_Uno_UI_Samples_UITests_BorderTestsControl_BorderCenteredwithmargins
    • Border_Border_Simple_No_Background_With_TextBox_Uno_UI_Samples_UITests_BorderTestsControl_Border_Simple_No_Background_With_TextBox
    • ListView_ListView_With_ListViews_Count_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
    • NavigationView_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage
    • TeachingTip_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage
    • Border_Border_Simple_Uno_UI_Samples_UITests_BorderTestsControl_Border_Simple
    • TabView_UITests_Microsoft_UI_Xaml_Controls_TabViewTests_TabViewPage_UITests_Microsoft_UI_Xaml_Controls_TabViewTests_TabViewPage
    • Scrolling_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage
    • TextBlock_UITests_Shared_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_Layout_UITests_Shared_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_Layout
    • Transform_Basics_UITests_Shared_Windows_UI_Xaml_Media_Transform_Basics
    • MediaPlayerElement_Using_3gp_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_3gp_Extension
    • MediaPlayerElement_Using_mp3_Audio_only_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Mp3_Extension
    • MediaPlayerElement_Using_ogg_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Ogg_Extension
  • ios: 7 changed over 267

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • TextBox_UpdatedBinding_On_OneWay_Mode_UITests_Windows_UI_Xaml_Controls_TextBox_TextBox_Bindings
    • When_SingleSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • When_ExtendedSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • When_MultipleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Check_ListView_Swallows_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
  • ios-Snap: 45 changed over 1057

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Brushes_ImageBrushAlignmentXY_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushAlignmentXY
    • Default_UITests_Windows_UI_Xaml_Controls_TextBox_TextBox_CornerRadius_UITests_Windows_UI_Xaml_Controls_TextBox_TextBox_CornerRadius
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Bigger_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Bigger
    • Default_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected
    • ToolTip_TextOnlyToolTipSample_UITests_Shared_Windows_UI_Xaml_Controls_ToolTip_TextOnlyToolTipSample
    • Brushes_RectangleStretchFill_Uno_UI_Samples_UITests_ImageBrushTestControl_RectangleStretchFill
    • Brushes_UITests_Windows_UI_Xaml_Media_BrushesTests_RevealBrush_Fallback_UITests_Windows_UI_Xaml_Media_BrushesTests_RevealBrush_Fallback
    • Brushes_Uno_UI_Samples_UITests_ImageBrushTestControl_DoubleImageBrushInList_Uno_UI_Samples_UITests_ImageBrushTestControl_DoubleImageBrushInList
    • ContentControl_ContentControl_Nested_TemplatedParent_Uno_UI_Samples_Content_UITests_ContentControlTestsControl_ContentControl_Nested_TemplatedParent
    • Image_EmptyImageFixedWidth_Uno_UI_Samples_UITests_ImageTestsControl_EmptyImageFixedWidth
    • MediaPlayerElement_Sources_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Sources
    • ListView_ListViewSelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • Windowing_UITests_Windows_UI_Xaml_WindowTests_Window_SetBackground_UITests_Windows_UI_Xaml_WindowTests_Window_SetBackground
    • Brushes_ImageBrushStretch2_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushStretch2
    • Brushes_PathImageBrushfill_Uno_UI_Samples_UITests_ImageBrushTestControl_PathImageBrushfill
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats
    • ListView_ListView_TextBox_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListView_TextBox
    • WebView_WebView2_JavascriptInvoke_SamplesApp_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_JavascriptInvoke
    • WebView_UITests_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_NavigationProperties_UITests_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_NavigationProperties
    • WebView_UITests_Microsoft_UI_Xaml_Controls_WebViewTests_WebView_InvokeScriptAsync_UITests_Microsoft_UI_Xaml_Controls_WebViewTests_WebView_InvokeScriptAsync
  • skia-gtk-screenshots: 62 changed over 2232

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • PanelImageBrush.png-dark
    • PanelImageBrush.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • RepeatButton_Automated.png-dark
    • RepeatButton_Automated.png
    • UIElement_ContextFlyout.png-dark
    • UIElement_ContextFlyout.png
    • UIElement_MeasureDirtyPath.png-dark
    • UIElement_MeasureDirtyPath.png
    • ClipboardTests.png
    • WinUIExpanderPage.png-dark
    • WinUIExpanderPage.png
    • WinUIProgressBarSimple.png-dark
    • WinUIProgressBarSimple.png
    • Focus_FocusVisual_Properties.png-dark
    • Ellipse.png-dark
    • Ellipse.png
    • DisplayInformation.png
    • ContentPresenter_NativeEmbedding.png-dark
  • skia-linux-screenshots: 72 changed over 2232

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
    • ImageBrushAlignmentXY2.png-dark
    • ImageBrushAlignmentXY2.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ImageBrushStretch2.png-dark
    • ImageBrushStretch2.png
    • Ellipse.png-dark
    • Ellipse.png
    • Buttons.png
    • CalendarView_Theming.png
    • ButtonClippingTestsControl.png-dark
  • skia-windows-screenshots: 63 changed over 2232

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • BorderImageBrush.png-dark
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Gamepad_CurrentReading.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • ColorPickerSample.png-dark
    • Buttons.png-dark
    • ImageBrush_UniformToFill.png-dark
    • ImageBrush_UniformToFill.png
    • ImageIconPage.png-dark
    • CalendarView_Theming.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ClipboardTests.png-dark
    • DragDrop_TestPage.png-dark
    • DragDrop_TestPage.png
    • ImageBrush_SameWithDelay.png-dark
  • wasm: 243 changed over 1043

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • GenericApp.Views.Samples.Shared.Content.UITests.GridViewMultipleSelectionMode
    • initial_state
    • SamplesApp.Windows_UI_Xaml.Clipping.Transform_Ellipse_in_Canvas_in_Grid
    • SamplesApp.Windows_UI_Xaml.Clipping.Transform_Ellipse_In_Canvas_in_Two_Grids
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewGroupedChanging
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewGroupedEmpty
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewStackPanel
    • UITests.Microsoft_UI_Xaml_Controls.RadioButtonsTests.RadioButtonsPage
    • UITests.Shared.Windows_UI_Input.CaptureTests.OverlappedControls
    • UITests.Shared.Windows_UI_Input.GestureRecognizerTests.Button_Inside_Border
    • UITests.Shared.Windows_UI_Xaml_Controls.ComboBox.ComboBox_ItemDataContext
    • UITests.Shared.Windows_UI_Xaml_Controls.ComboBox.ComboBox_MaxDropdownHeight
    • UITests.Windows_UI_Xaml.FocusTests.Focus_VisualStates
    • UITests.Windows_UI_Xaml.FrameworkElementTests.DynamicBackgroundSizing
    • UITests.Windows_UI_Xaml.FrameworkElementTests.FrameworkElement_Opacity
    • UITests.Windows_UI_Xaml.FrameworkElementTests.FrameworkElement_Sizes
    • UITests.Windows_UI_Xaml_Controls.ImageTests.Image_Source_Nullify
    • UITests.Windows_UI_Xaml_Controls.ImageTests.Image_Transforms
    • UITests.Windows_UI_Xaml_Controls.SymbolIconTests.SymbolIcon_Generic
    • GenericApp.Views.Samples.Shared.Content.UITests.GridViewGrouped
  • wasm-automated-net9.0-UWP-Default-automated: 25 changed over 1947

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Default_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation
    • Default_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected
    • Default_StrokeThickness_MyPolygon
    • Expander_WinUIExpanderPage_UITests_Shared_Microsoft_UI_Xaml_Controls_ExpanderTests_WinUIExpanderPage
    • Brushes_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrush_StreamSource_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrush_StreamSource
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • Default_StrokeThickness_MyRect
    • MediaPlayerElement_Using_3gp_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_3gp_Extension
    • MediaPlayerElement_Using_mp3_Audio_only_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Mp3_Extension
    • MediaPlayerElement_Using_ogg_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Ogg_Extension
    • Clipping_UITests_Windows_UI_Xaml_Clipping_BorderVisualClipping_UITests_Windows_UI_Xaml_Clipping_BorderVisualClipping
    • ListView_ListViewSelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • Screenshots_Image_Stretch_Alignment_Bigger_Mode-1
    • TextBlock_UITests_Shared_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_Layout_UITests_Shared_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_Layout
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • MediaPlayerElement_Sources_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Sources
    • TestProgressRing_InitialState_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
    • Screenshots_Image_Stretch_Alignment_Bigger_Mode-2
    • When_Theme_Changed_No_Crash_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
    • Pickers_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
  • wasm-automated-net9.0-UWP-RuntimeTests-0: 0 changed over 1

  • wasm-automated-net9.0-UWP-RuntimeTests-1: 0 changed over 1

  • wasm-automated-net9.0-UWP-RuntimeTests-2: 0 changed over 1

  • wasm-automated-net9.0-WinUI-Benchmarks-automated: 0 changed over 1

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

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

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

{
var created = Activator.CreateInstance(classType);
TrySetContextualProperties(created, control);

return created;
}

var type = TypeResolver.FindType(control.Type);
#if false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this disabled? Is it only for the comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add XamlReader support for MarkupExtension
4 participants