Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dr1rrb
Copy link
Member

@dr1rrb dr1rrb commented Nov 17, 2025

closes #21860
closes https://github.com/unoplatform/uno.hotdesign/issues/5418

✨ Feature / 🐞 Bugfix

✨ Add ability to pass over invalid binding syntax in code gen
🐞Fix possible ENC0004 with HR

What is the current behavior? πŸ€”

  • Fails when facing invalid syntax in bindings
  • With some specific changes we might get a ENC0004 error because fuzzy matching or method name confuse changes and think that a method modifier has been changed.

What is the new behavior? πŸš€

  • Properly reports error and continue generation when an invalid syntax for binding is found
  • When HR is enabled, we don't generate static method.

PR Checklist βœ…

Other information ℹ️

This PR is based on #21865 (and contains same changes)

Copilot AI review requested due to automatic review settings November 17, 2025 21:20
@github-actions github-actions bot added the area/code-generation Categorizes an issue or PR as relevant to code generation label Nov 17, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a potential ENC0004 error during Hot Reload by conditionally removing the static modifier from generated template builder methods when HR is enabled. The PR also enhances error handling by supporting multiple parsing errors per file and adds validation for RelativeSource bindings in XAML.

Key Changes

  • Removes static modifier from template builder methods when Hot Reload is enabled to prevent ENC0004 errors
  • Refactors error handling from single to multiple errors per XAML file
  • Adds validation for RelativeSource binding syntax and properties
  • Includes cache key updates to account for source link variations

Reviewed Changes

Copilot reviewed 26 out of 57 changed files in this pull request and generated no comments.

Show a summary per file
File Description
XamlFileGenerator.cs Conditionally generates instance methods instead of static when HR is enabled; adds RelativeSource validation
XamlFileDefinition.cs Changes from single ParsingError to ParsingErrors collection; makes SourceLink required in constructor
XamlFileParser.cs Refactors to use XamlFileParserContext for error collection; adds missing comma detection in bindings
XamlFileParserContext.cs New class for collecting multiple parsing errors during XAML parsing
XamlCodeGeneration.cs Updates to iterate over multiple errors instead of single error
XamlFileParser.Cache.cs Adds Link to cache key to differentiate files with same content but different links
Test files Multiple new tests for error scenarios and Hot Reload scenarios; updated expected outputs

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21867/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-21867/wasm-skia-net9/index.html

Copilot AI review requested due to automatic review settings November 17, 2025 22:31
@dr1rrb dr1rrb marked this pull request as ready for review November 17, 2025 22:33
@dr1rrb dr1rrb enabled auto-merge November 17, 2025 22:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 26 out of 59 changed files in this pull request and generated no new comments.

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21867/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-21867/wasm-skia-net9/index.html

@nventive-devops
Copy link
Contributor

The build 183567 found UI Test snapshots differences: android-28-net9: 17, android-28-net9-Snap: 29, ios: 7, ios-Snap: 49, skia-linux-screenshots: 77, skia-windows-screenshots: 584, wasm: 132, wasm-automated-net10.0-WinUI-Benchmarks-automated: 0, wasm-automated-net10.0-WinUI-Default-automated: 13, 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) 🚨🚨
    • DecimalFormatterTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • Detereminate_ProgressRing_Validation50_[#FF0000_#008000_#008000_#FF0000]_Progress-Ring-Value-50
    • NativeCommandBar_Size_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Dynamic
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • UpDownEnabledTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • ListView_ListViewWithHeader_InitializesTest_SamplesApp_Windows_UI_Xaml_Controls_ListView_HorizontalListViewGrouped
    • When_ExtendedSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • Detereminate_ProgressRing_Validation25_[#FF0000_#008000_#FF0000_#FF0000]_Progress-Ring-Value-25
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • 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
    • Detereminate_ProgressRing_Validation75_[#FF0000_#008000_#008000_#008000]_Progress-Ring-Value-75
    • WebView_NavigateToAnchor_Initial
    • 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
  • android-28-net9-Snap: 29 changed over 1077

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Basic_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Basic
    • SwipeControl_MUXControlsTestApp_SwipeControlPage2_MUXControlsTestApp_SwipeControlPage2
    • Icons_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground
    • TeachingTip_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavOnlyPage_MUXControlsTestApp_NavigationViewTopNavOnlyPage
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavPage_MUXControlsTestApp_NavigationViewTopNavPage
    • NavigationView_MUXControlsTestApp_NavigationViewRS4Page_MUXControlsTestApp_NavigationViewRS4Page
    • CommandBarFlyout_MUXControlsTestApp_CommandBarFlyoutPage_MUXControlsTestApp_CommandBarFlyoutPage
    • Default_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation
    • MUX_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage
    • Scrolling_MUXControlsTestApp_ScrollViewWithScrollControllersPage_MUXControlsTestApp_ScrollViewWithScrollControllersPage
    • ListView_ListView_With_ListViews_Count_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
    • MUX_NumberBox_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • 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
    • Scrolling_MUXControlsTestApp_ScrollViewDynamicPage_MUXControlsTestApp_ScrollViewDynamicPage
    • Scrolling_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage
    • TabView_MUXControlsTestApp_TabViewPage_MUXControlsTestApp_TabViewPage
    • Gesture_Recognizer_Pointer_Events_test_bench_UITests_Shared_Windows_UI_Input_GestureRecognizer_PointersEvents
  • ios: 7 changed over 255

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • TextBox_UpdatedBinding_On_OneWay_Mode_UITests_Windows_UI_Xaml_Controls_TextBox_TextBox_Bindings
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • Validate_Offscreen_Shapes_UITests_Windows_UI_Xaml_Shapes_Offscreen_Shapes
  • ios-Snap: 49 changed over 994

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Brushes_ImageBrushWithCompositeTransform_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushWithCompositeTransform
    • ContentControl_ContentControl_Nested_TemplatedParent_Uno_UI_Samples_Content_UITests_ContentControlTestsControl_ContentControl_Nested_TemplatedParent
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats
    • Brushes_PathImageBrushfill_Uno_UI_Samples_UITests_ImageBrushTestControl_PathImageBrushfill
    • NavigationView_MUXControlsTestApp_NavigationViewAnimationPage_MUXControlsTestApp_NavigationViewAnimationPage
    • NavigationView_MUXControlsTestApp_NavigationViewBlankPage1_MUXControlsTestApp_NavigationViewBlankPage1
    • Popup_MessageDialog_UITests_Shared_Windows_UI_Xaml_Controls_Popup_MessageDialog
    • Brushes_ImageBrushWithScaleTransform_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushWithScaleTransform
    • Default_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected
    • Image_Image_Stretch_None_Uno_UI_Samples_UITests_ImageTestsControl_Image_Stretch_None
    • NavigationView_MUXControlsTestApp_NavigationViewSelectedItemEdgeCasePage_MUXControlsTestApp_NavigationViewSelectedItemEdgeCasePage
    • Default_Uno_UI_Samples_UITests_Image_Image_Margin_Uno_UI_Samples_UITests_Image_Image_Margin
    • Default_Uno_UI_Samples_UITests_Image_Image_UseTargetSize_Uno_UI_Samples_UITests_Image_Image_UseTargetSize
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Bigger_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Bigger
    • 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
    • Brushes_ImageBrushStretch2_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushStretch2
    • NavigationView_MUXControlsTestApp_NavigationViewCompactPaneLengthTestPage_MUXControlsTestApp_NavigationViewCompactPaneLengthTestPage
    • NavigationView_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage
  • skia-linux-screenshots: 77 changed over 2304

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ColorPickerSample.png-dark
    • DropDownButtonPage.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png
    • ClipboardTests.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ImageBrush_Stretch.png-dark
    • ImageBrush_Stretch.png
    • Buttons.png-dark
    • Buttons.png
    • ColorPickerSample.png
  • skia-windows-screenshots: 584 changed over 2304

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppWindowPresenters.png-dark
    • AuthenticationBroker_Demo.png-dark
    • ClippingToControlBounds.png
    • ContentControl_SelectorInheritance.png-dark
    • ContentControl_SelectorInheritance.png
    • ContentPresenter_ImplicitContent.png-dark
    • ContentPresenter_ImplicitContent.png
    • ContentPresenter_LocalOverride.png-dark
    • ContentPresenter_LocalOverride.png
    • FrameworkElement_AsyncFlow.png-dark
    • FrameworkElement_AsyncFlow.png
    • AndroidWindowInsets.png
    • AnimatedIconPage.png
    • ApplicationViewSizing.png-dark
    • AppWindowClosing.png
    • AppWindowTitleBar Properties.png-dark
    • BasicEnability.png-dark
    • ContentControl_DefaultText.png-dark
    • ContentControl_DefaultText.png
    • ContentControl_FindName.png-dark
  • wasm: 132 changed over 1058

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • MUXControlsTestApp.NavigationViewStretchPage
    • MUXControlsTestApp.PipsPagerPage
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.UndefinedHeightListView
    • UITests.Microsoft_UI_Xaml_Controls.RatingControlTests.RatingControlPage
    • UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests.TextBox_Selection
    • UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests.TextBox_TextChanged
    • UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests.TextBox_TextChanging
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Controls.TimePicker.TimePicker_Header
    • UITests.Windows_UI_Xaml_Controls.TimePicker.TimePicker_TimePickerFlyoutStyle
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewIncrementalLoading
    • UITests.Microsoft_UI_Xaml_Controls.InfoBadgeTests.InfoBadgePage
    • UITests.Shared.Windows_UI_Xaml_Controls.TextBlockControl.SimpleText_MaxLines_Different_Font_Size
    • UITests.Shared.Windows_UI_Xaml_Controls.TextBlockControl.TextBlock_Foreground_While_Collapsed
    • UITests.Windows_Gaming.GamepadEnumerationTest
    • UITests.Windows_UI_Xaml.WindowTests.Window_Metrics
    • UITests.Windows_UI_Xaml_Controls.TextBlockControl.TextBlock_IsTextSelectionEnabled
    • UITests.Windows_UI_Xaml_Controls.TextBlockControl.TextBlock_LayoutAlignment
    • Uno.UI.Samples.Content.UITests.ButtonTestsControl.RadioButton_Multiple_Unnamed_Groups
    • Uno.UI.Samples.Content.UITests.ButtonTestsControl.RadioButton_With_GroupName
  • wasm-automated-net10.0-WinUI-Benchmarks-automated: 0 changed over 1

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

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Default_StrokeThickness_MyEllipse
    • Default_StrokeThickness_MyPolygon
    • TestProgressRing_InitialState_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
    • When_MultipleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Default_StrokeThickness_MyPath
    • Default_StrokeThickness_MyLine
    • Default_StrokeThickness_MyRect
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • Default_StrokeThickness_MyPolyline
    • When_NoSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_TransformToVisual_ScrollViewer_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_ScrollViewer
  • 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

@dr1rrb dr1rrb changed the title Fix possible ENC0004 with HR Improves XAML code gen (Error reporting + HR) Nov 18, 2025
@dr1rrb
Copy link
Member Author

dr1rrb commented Nov 18, 2025

About relevant comments from copilot: they are addressed in a coming PR #21874

@dr1rrb dr1rrb merged commit 4b72708 into master Nov 18, 2025
106 checks passed
@dr1rrb dr1rrb deleted the dev/dr/hrFail branch November 18, 2025 15:24
@agneszitte
Copy link
Contributor

@mergify backport release/stable/6.4

@mergify
Copy link
Contributor

mergify bot commented Nov 19, 2025

backport release/stable/6.4

βœ… Backports have been created

Details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/code-generation Categorizes an issue or PR as relevant to code generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XAML Code gen fail when XAML is invalid

6 participants