Skip to content

Fixed: Missing diagnostic in SourceGen when Setter references non-BindableProperty - Candidate Failure Feb 2nd#33854

Merged
simonrozsival merged 1 commit intodotnet:inflight/candidatefrom
Ahamed-Ali:fixcandidate33835
Feb 3, 2026
Merged

Fixed: Missing diagnostic in SourceGen when Setter references non-BindableProperty - Candidate Failure Feb 2nd#33854
simonrozsival merged 1 commit intodotnet:inflight/candidatefrom
Ahamed-Ali:fixcandidate33835

Conversation

@Ahamed-Ali
Copy link
Contributor

@Ahamed-Ali Ahamed-Ali commented Feb 3, 2026

Root Cause of the issue

  • The SourceGen XAML inflator was silently failing when a Setter referenced a non-BindableProperty/ Property doesn't exist, while XamlC and Runtime inflators correctly reported errors.

The Problem:
XamlC behavior (compile-time): Throws BuildException when encountering on a property that isn't a BindableProperty

Runtime inflator behavior: Throws XamlParseException for the same invalid XAML

SourceGen behavior (BEFORE fix):

SetterValueProvider.TryProvideValue() would detect the property can't be resolved
Returns false without reporting any diagnostic

Silently fails - no error message to the developer
Test expected (ShouldThrow(inflator: SourceGen) Assert.NotEmpty(result.Diagnostics) but got empty diagnostics ❌
Why It Failed Silently:
When TryGetBindablePropertyNameAndType() returns false (property not found):

Description of Change

  • Detects failure: When TryGetBindablePropertyNameAndType returns false (property doesn't exist or isn't a BindableProperty)

Reports diagnostic: Uses Descriptors.MemberResolution (MAUIX2002) - the standard "cannot resolve member" error

Provides context:

Exact location in XAML file (line/column)
Property name that failed to resolve
Consistent behavior: Now all three inflators report errors for invalid Setter properties:

✅ XamlC → BuildException
✅ Runtime → XamlParseException
✅ SourceGen → Diagnostic (MAUIX2002)

Unit Test case failed

ShouldThrow(inflator: SourceGen
https://dev.azure.com/dnceng-public/public/_build/results?buildId=1272666&view=ms.vss-test-web.build-test-results-tab&runId=35509658&resultId=101501&paneView=debug

Test location: https://github.com/dotnet/maui/blob/inflight/candidate/src/Controls/tests/Xaml.UnitTests/Validation/SetterOnNonBP.rt.xaml.cs#L22

Issues Fixed

Fixes #33562

Screenshot

Before Issue Fix After Issue Fix

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Feb 3, 2026
@Ahamed-Ali Ahamed-Ali added the community ✨ Community Contribution label Feb 3, 2026
@Ahamed-Ali Ahamed-Ali changed the title Fixed the diagnostic issue with the non bindable/ not resolved property Fixed: Missing diagnostic in SourceGen when Setter references non-BindableProperty Feb 3, 2026
@Ahamed-Ali Ahamed-Ali changed the title Fixed: Missing diagnostic in SourceGen when Setter references non-BindableProperty Fixed: Missing diagnostic in SourceGen when Setter references non-BindableProperty - Candidate Failures Feb 2nd Feb 3, 2026
@Ahamed-Ali Ahamed-Ali changed the title Fixed: Missing diagnostic in SourceGen when Setter references non-BindableProperty - Candidate Failures Feb 2nd Fixed: Missing diagnostic in SourceGen when Setter references non-BindableProperty - Candidate Failure Feb 2nd Feb 3, 2026
@sheiksyedm sheiksyedm added the xsg Xaml sourceGen label Feb 3, 2026
@sheiksyedm sheiksyedm marked this pull request as ready for review February 3, 2026 07:51
@simonrozsival
Copy link
Member

/azp run maui-pr

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@simonrozsival simonrozsival merged commit db044ac into dotnet:inflight/candidate Feb 3, 2026
23 of 34 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 8, 2026
…dableProperty - Candidate Failure Feb 2nd (#33854)

### Root Cause of the issue



- The SourceGen XAML inflator was silently failing when a Setter
referenced a **non-BindableProperty**/ Property doesn't exist, while
XamlC and Runtime inflators correctly reported errors.
 
The Problem:
XamlC behavior (compile-time): Throws BuildException when encountering
<Setter Property="NonBindable" /> on a property that isn't a
BindableProperty
 
Runtime inflator behavior: Throws XamlParseException for the same
invalid XAML
 
SourceGen behavior (BEFORE fix):
 
SetterValueProvider.TryProvideValue() would detect the property can't be
resolved
Returns `false` without reporting any diagnostic

**Silently fails - no error message to the developer**
Test expected (`ShouldThrow(inflator: SourceGen`)
Assert.NotEmpty(result.Diagnostics) but got empty diagnostics ❌
Why It Failed Silently:
When TryGetBindablePropertyNameAndType() returns false (property not
found):


### Description of Change



- Detects failure: When TryGetBindablePropertyNameAndType returns false
(property doesn't exist or isn't a BindableProperty)
 
Reports diagnostic: Uses Descriptors.MemberResolution (MAUIX2002) - the
standard "cannot resolve member" error
 
Provides context:
 
Exact location in XAML file (line/column)
Property name that failed to resolve
Consistent behavior: Now all three inflators report errors for invalid
Setter properties:
 
✅ XamlC → BuildException
✅ Runtime → XamlParseException
✅ SourceGen → Diagnostic (MAUIX2002)


### Unit Test case failed

**ShouldThrow(inflator: SourceGen**

https://dev.azure.com/dnceng-public/public/_build/results?buildId=1272666&view=ms.vss-test-web.build-test-results-tab&runId=35509658&resultId=101501&paneView=debug

Test location:
https://github.com/dotnet/maui/blob/inflight/candidate/src/Controls/tests/Xaml.UnitTests/Validation/SetterOnNonBP.rt.xaml.cs#L22



### Issues Fixed



Fixes #33562 


### Screenshot



| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="400" height="500"
src="https://github.com/user-attachments/assets/8128a742-460a-48fa-82bb-d310b80f688c"/>
| <img width="400" height="500"
src="https://github.com/user-attachments/assets/196f856b-9d45-4604-adc9-ae233ac09b1f">
|
PureWeen pushed a commit that referenced this pull request Feb 9, 2026
…dableProperty - Candidate Failure Feb 2nd (#33854)

### Root Cause of the issue



- The SourceGen XAML inflator was silently failing when a Setter
referenced a **non-BindableProperty**/ Property doesn't exist, while
XamlC and Runtime inflators correctly reported errors.
 
The Problem:
XamlC behavior (compile-time): Throws BuildException when encountering
<Setter Property="NonBindable" /> on a property that isn't a
BindableProperty
 
Runtime inflator behavior: Throws XamlParseException for the same
invalid XAML
 
SourceGen behavior (BEFORE fix):
 
SetterValueProvider.TryProvideValue() would detect the property can't be
resolved
Returns `false` without reporting any diagnostic

**Silently fails - no error message to the developer**
Test expected (`ShouldThrow(inflator: SourceGen`)
Assert.NotEmpty(result.Diagnostics) but got empty diagnostics ❌
Why It Failed Silently:
When TryGetBindablePropertyNameAndType() returns false (property not
found):


### Description of Change



- Detects failure: When TryGetBindablePropertyNameAndType returns false
(property doesn't exist or isn't a BindableProperty)
 
Reports diagnostic: Uses Descriptors.MemberResolution (MAUIX2002) - the
standard "cannot resolve member" error
 
Provides context:
 
Exact location in XAML file (line/column)
Property name that failed to resolve
Consistent behavior: Now all three inflators report errors for invalid
Setter properties:
 
✅ XamlC → BuildException
✅ Runtime → XamlParseException
✅ SourceGen → Diagnostic (MAUIX2002)


### Unit Test case failed

**ShouldThrow(inflator: SourceGen**

https://dev.azure.com/dnceng-public/public/_build/results?buildId=1272666&view=ms.vss-test-web.build-test-results-tab&runId=35509658&resultId=101501&paneView=debug

Test location:
https://github.com/dotnet/maui/blob/inflight/candidate/src/Controls/tests/Xaml.UnitTests/Validation/SetterOnNonBP.rt.xaml.cs#L22



### Issues Fixed



Fixes #33562 


### Screenshot



| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="400" height="500"
src="https://github.com/user-attachments/assets/8128a742-460a-48fa-82bb-d310b80f688c"/>
| <img width="400" height="500"
src="https://github.com/user-attachments/assets/196f856b-9d45-4604-adc9-ae233ac09b1f">
|
github-actions bot pushed a commit that referenced this pull request Feb 9, 2026
…dableProperty - Candidate Failure Feb 2nd (#33854)

### Root Cause of the issue



- The SourceGen XAML inflator was silently failing when a Setter
referenced a **non-BindableProperty**/ Property doesn't exist, while
XamlC and Runtime inflators correctly reported errors.
 
The Problem:
XamlC behavior (compile-time): Throws BuildException when encountering
<Setter Property="NonBindable" /> on a property that isn't a
BindableProperty
 
Runtime inflator behavior: Throws XamlParseException for the same
invalid XAML
 
SourceGen behavior (BEFORE fix):
 
SetterValueProvider.TryProvideValue() would detect the property can't be
resolved
Returns `false` without reporting any diagnostic

**Silently fails - no error message to the developer**
Test expected (`ShouldThrow(inflator: SourceGen`)
Assert.NotEmpty(result.Diagnostics) but got empty diagnostics ❌
Why It Failed Silently:
When TryGetBindablePropertyNameAndType() returns false (property not
found):


### Description of Change



- Detects failure: When TryGetBindablePropertyNameAndType returns false
(property doesn't exist or isn't a BindableProperty)
 
Reports diagnostic: Uses Descriptors.MemberResolution (MAUIX2002) - the
standard "cannot resolve member" error
 
Provides context:
 
Exact location in XAML file (line/column)
Property name that failed to resolve
Consistent behavior: Now all three inflators report errors for invalid
Setter properties:
 
✅ XamlC → BuildException
✅ Runtime → XamlParseException
✅ SourceGen → Diagnostic (MAUIX2002)


### Unit Test case failed

**ShouldThrow(inflator: SourceGen**

https://dev.azure.com/dnceng-public/public/_build/results?buildId=1272666&view=ms.vss-test-web.build-test-results-tab&runId=35509658&resultId=101501&paneView=debug

Test location:
https://github.com/dotnet/maui/blob/inflight/candidate/src/Controls/tests/Xaml.UnitTests/Validation/SetterOnNonBP.rt.xaml.cs#L22



### Issues Fixed



Fixes #33562 


### Screenshot



| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="400" height="500"
src="https://github.com/user-attachments/assets/8128a742-460a-48fa-82bb-d310b80f688c"/>
| <img width="400" height="500"
src="https://github.com/user-attachments/assets/196f856b-9d45-4604-adc9-ae233ac09b1f">
|
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 xsg Xaml sourceGen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants