Skip to content

Conversation

@StephaneDelcroix
Copy link
Contributor

Description of Change

Enable XSG on HostApp and fix nullability issue

requires #32034

Copilot AI review requested due to automatic review settings October 17, 2025 06:44
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

Enable XAML Source Generator (XSG) in the HostApp test project and adjust event handler signatures for nullable sender parameters.

  • Add MauiXaml ItemGroup with Inflator="SourceGen" to Controls.TestCases.HostApp.csproj.
  • Update several event handler signatures to accept nullable object? sender (nullability fix).

Reviewed Changes

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

Show a summary per file
File Description
Issue25724.xaml.cs Updated event handler sender parameter to nullable.
Issue23868.xaml.cs Updated multiple event handler sender parameters to nullable.
Issue20903.xaml.cs Updated button click handler sender parameter to nullable.
Issue14825.xaml.cs Updated capture button handler sender parameter to nullable.
Controls.TestCases.HostApp.csproj Enabled XAML Source Generation for all XAML files in the HostApp project.

@StephaneDelcroix StephaneDelcroix changed the base branch from net10.0 to main October 29, 2025 11:13
@StephaneDelcroix StephaneDelcroix added this to the .NET 10 SR1 milestone Oct 29, 2025
@StephaneDelcroix
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@StephaneDelcroix
Copy link
Contributor Author

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Comment on lines -16 to +17
public required DataTemplate ValidTemplate { get; set; }
public required DataTemplate InvalidTemplate { get; set; }
public DataTemplate ValidTemplate { get; set; }
public DataTemplate InvalidTemplate { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Just checking why this was made? Was it invalid before or is there a change in XSG to make it work coming later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The required comes from the templates, and we removed the required from the templates. while inflating at runtime, or with XamlC, XAML ignores the required keyword and sets them as normal properties.
There is basic support right now in XSG to support required properties (for direct values e.g.) and it sends a warning on complex ones saying 'this might not work as expected for the moment'.
there is a plan, and the work is already quite advanced, to support required as well as back x:References with XSG, but that work isn't finished yet and will ship later. in the meantime, we advise not to use required properties and do a runtime check of the presence instead of a compiler check

@StephaneDelcroix StephaneDelcroix merged commit 75eb106 into main Nov 2, 2025
165 checks passed
@StephaneDelcroix StephaneDelcroix deleted the dev/stdelc/hostapp-xsg branch November 2, 2025 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

xsg Xaml sourceGen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants