Fixed: Missing diagnostic in SourceGen when Setter references non-BindableProperty - Candidate Failure Feb 2nd#33854
Merged
simonrozsival merged 1 commit intodotnet:inflight/candidatefrom Feb 3, 2026
Conversation
Member
|
/azp run maui-pr |
|
Azure Pipelines successfully started running 1 pipeline(s). |
simonrozsival
approved these changes
Feb 3, 2026
db044ac
into
dotnet:inflight/candidate
23 of 34 checks passed
This was referenced Feb 3, 2026
Open
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"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root Cause of the issue
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
falsewithout reporting any diagnosticSilently 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
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