Skip to content

Enable MAUI XAML SourceGen compilation#848

Open
Vetle444 wants to merge 4 commits intomainfrom
vefi/sourceGen
Open

Enable MAUI XAML SourceGen compilation#848
Vetle444 wants to merge 4 commits intomainfrom
vefi/sourceGen

Conversation

@Vetle444
Copy link
Copy Markdown
Contributor

Why

Switches XAML inflation from the legacy XamlC (IL-weaving) approach to the new SourceGen source-generator-based compilation. Benefits:

  • Hot Reload — SourceGen enables better XAML Hot Reload support during development
  • Debug performance — Faster debug builds since SourceGen avoids the IL-weaving step
  • Debug/Release parity — Debug mode now behaves more similarly to Release mode, reducing "works in debug but not release" surprises
  • Future alignment — Better trimming/AOT support, aligning with the direction .NET MAUI is heading for XAML compilation

Changes

  • Enable MauiXamlInflator=SourceGen in all projects:

    • DIPS.Mobile.UI (library)
    • Components, Playground, MemoryLeakTests (apps)
  • Change initset on properties that SourceGen needs to set during XAML inflation:

    • CollectionView.RemoveFocusOnScroll
    • CollectionView.FirstItemCornerRadius
    • CollectionView.LastItemCornerRadius
    • ScrollView.RemoveFocusOnScroll

    SourceGen generates code that assigns property values directly (rather than IL-weaving), so properties set from XAML must have a public set accessor — init is not sufficient.

Copilot AI review requested due to automatic review settings April 23, 2026 11:15
@Vetle444
Copy link
Copy Markdown
Contributor Author

Waits until we have released before enabling.

@eirinsvi
Copy link
Copy Markdown
Contributor

kan vi gjøre det i playground også?

Copy link
Copy Markdown
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 switches the solution’s MAUI XAML inflation from legacy XamlC (IL weaving) to the SourceGen-based inflator to improve Hot Reload support and build/debug performance, and adjusts a few component properties to be compatible with SourceGen’s generated setters.

Changes:

  • Enable MauiXamlInflator=SourceGen across the library and app projects.
  • Change select component properties from init to set so SourceGen can assign them during XAML inflation.
  • Bump CHANGELOG.md with a new release entry for the SourceGen switch.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/library/DIPS.Mobile.UI/DIPS.Mobile.UI.csproj Enables SourceGen XAML inflator for the UI component library.
src/library/DIPS.Mobile.UI/Components/Lists/ScrollView/ScrollView.Properties.cs Changes RemoveFocusOnScroll to a settable property for SourceGen compatibility.
src/library/DIPS.Mobile.UI/Components/Lists/CollectionView/CollectionView.Properties.cs Changes RemoveFocusOnScroll and corner radius properties to settable for SourceGen compatibility.
src/app/Playground/Playground.csproj Enables SourceGen XAML inflator for the Playground app.
src/app/MemoryLeakTests/MemoryLeakTests.csproj Enables SourceGen XAML inflator for the memory leak test app.
src/app/Components/Components.csproj Enables SourceGen XAML inflator for the Components app.
CHANGELOG.md Adds a new version entry documenting the SourceGen switch.

Comment thread src/library/DIPS.Mobile.UI/Components/Lists/ScrollView/ScrollView.Properties.cs Outdated
@Vetle444
Copy link
Copy Markdown
Contributor Author

kan vi gjøre det i playground også?

Dæ e satt der også ja

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants