-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[XSG] Enable XSG on HostApp #32039
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
[XSG] Enable XSG on HostApp #32039
Conversation
There was a problem hiding this 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. |
ce6b8be to
939152a
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
fix nullability issue
ec572a3 to
0080cbf
Compare
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| public required DataTemplate ValidTemplate { get; set; } | ||
| public required DataTemplate InvalidTemplate { get; set; } | ||
| public DataTemplate ValidTemplate { get; set; } | ||
| public DataTemplate InvalidTemplate { get; set; } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Description of Change
Enable XSG on HostApp and fix nullability issue
requires #32034