Skip to content

[Inflight/Candidate] Fix the Build errors when build src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj in release. - #36607

Merged
kubaflo merged 2 commits into
dotnet:inflight/candidatefrom
KarthikRajaKalaimani:fix-23711-3
Jul 20, 2026
Merged

[Inflight/Candidate] Fix the Build errors when build src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj in release.#36607
kubaflo merged 2 commits into
dotnet:inflight/candidatefrom
KarthikRajaKalaimani:fix-23711-3

Conversation

@KarthikRajaKalaimani

Copy link
Copy Markdown
Contributor

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!

Issue Details:

Build error occurs when build src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj in release.

Root Cause:

Release uses the XamlC inflator by default, which fully compiles bindings at build time. PR #35798's new TryGetRelativeSourceAncestorTypeReference logic in SetPropertiesVisitor.cs now treats AncestorType={x:Type ContentPage} as the effective source type for validation, and since SelectedItem / NavigateCommand only exist on BasePage (not ContentPage), it raises XC0045 and fails the build.

Description of Change:

The fix was applied at the source level in src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs . A new tSourceRefIsAncestorTypeInferred flag now tracks whether the binding's source type came purely from AncestorType inference rather than an explicit x:DataType on the binding node. When property-path resolution against that inferred type fails, and this flag is set, the error is suppressed and the method returns false to gracefully skip TypedBinding compilation — falling back to the original reflection-based Binding , exactly as XamlC always did before PR #35798 for these ambiguous cases. This also mirrors the SourceGen inflator's existing equivalent fallback in KnownMarkups.ProvideValueForBindingExtension . Bindings with an explicit x:DataType , or where the property genuinely doesn't exist anywhere in the runtime ancestor chain, are unaffected and continue to raise XC0045 as intended, preserving PR #35798's original AOT-safety fix.

Tested the behavior in the following platforms:

  • Android
  • Windows
  • iOS
  • Mac

Reference:

N/A

Issues Fixed:

Fixes #36563

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Jul 16, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @@KarthikRajaKalaimani! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jul 16, 2026
@vishnumenon2684

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@vishnumenon2684

Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests , maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@sheiksyedm
sheiksyedm marked this pull request as ready for review July 20, 2026 14:30
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo
kubaflo merged commit 639bd3d into dotnet:inflight/candidate Jul 20, 2026
89 of 168 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR10 milestone Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants