Skip to content

Fix XAML compiled binding warnings in DeviceTests.Runners by adding x:DataType attributes#30219

Merged
PureWeen merged 2 commits intomainfrom
copilot/fix-30214-2
Aug 15, 2025
Merged

Fix XAML compiled binding warnings in DeviceTests.Runners by adding x:DataType attributes#30219
PureWeen merged 2 commits intomainfrom
copilot/fix-30214-2

Conversation

Copy link
Contributor

Copilot AI commented Jun 25, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

This PR resolves 37 XC0022 warnings in the DeviceTests.Runners project by adding proper x:DataType attributes to enable compiled bindings for improved runtime performance.

Problem

The DeviceTests.Runners project was generating numerous XC0022 warnings:

XamlC warning XC0022: Binding could be compiled to improve runtime performance if x:DataType is specified.

These warnings were appearing across three XAML files:

  • HomePage.xaml - 16 warnings
  • TestAssemblyPage.xaml - 20 warnings
  • TestResultPage.xaml - 8 warnings

Solution

Added appropriate x:DataType attributes to enable compiled bindings:

HomePage.xaml

  • Added xmlns:local namespace reference
  • Added x:DataType="local:HomeViewModel" to root ContentPage
  • Added x:DataType="local:TestAssemblyViewModel" to CollectionView DataTemplate
  • Added x:DataType="CollectionView" to binding with explicit Source reference

TestAssemblyPage.xaml

  • Added x:DataType="local:TestAssemblyViewModel" to root ContentPage
  • Added x:DataType="local:TestCaseViewModel" to CollectionView DataTemplate
  • Added x:DataType="CollectionView" to binding with explicit Source reference

TestResultPage.xaml

  • Added xmlns:local namespace reference
  • Added x:DataType="local:TestResultViewModel" to root ContentPage

Results

  • ✅ All 37 XC0022 warnings eliminated
  • ✅ Build succeeds with no compilation errors
  • ✅ Enables compiled bindings for improved runtime performance
  • ✅ Minimal, surgical changes with no functional impact

The changes follow .NET MAUI best practices for compiled bindings as documented in the official guidance.

Fixes #30214.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix warnings on DeviceTests.Runners Fix XAML compiled binding warnings in DeviceTests.Runners by adding x:DataType attributes Jun 25, 2025
Copilot AI requested a review from mattleibow June 25, 2025 19:57
@mattleibow mattleibow marked this pull request as ready for review June 25, 2025 21:09
@mattleibow mattleibow requested a review from a team as a code owner June 25, 2025 21:09
@mattleibow
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen merged commit edd0e06 into main Aug 15, 2025
132 checks passed
@PureWeen PureWeen deleted the copilot/fix-30214-2 branch August 15, 2025 23:24
rmarinho added a commit that referenced this pull request Aug 19, 2025
* Update bug-report.yml 9.0.100 SR10 (#31163)

* Update ShellItemRenderer.cs (#31170)

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* [create-pull-request] automated change (#31181)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix XAML compiled binding warnings in DeviceTests.Runners by adding x:DataType attributes (#30219)

* Initial plan

* Fix XAML compiled binding warnings by adding x:DataType attributes

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>

* Move externally linked XML API docs to inline source code documentation (#30313)

* Initial plan

* Convert first batch of XML docs to inline documentation

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

* Convert second batch of XML docs to inline documentation

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

* Convert third batch of XML docs to inline documentation

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

# Conflicts:
#	src/Controls/src/Core/BoxView/BoxView.cs

* Convert fourth batch (50 files) of XML docs to inline documentation

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

* Convert fifth batch (100 files) of XML docs to inline documentation - Major milestone!

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

* Fix documentation issues - remove T: prefixes, fix generic types, replace "To be added", spell check

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

* Fix internal use documentation and CS1573 warnings

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

* Delete unused XML documentation files from converted classes

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

* Delete 76 truly unreferenced XML documentation files

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>

* [create-pull-request] automated change (#31197)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* [ci] Fix merge

* Update TestAssemblyPage.xaml

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Sep 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix warnings on DeviceTests.Runners

5 participants