[XSG] Make AppThemeBinding class public in net11#32678
Closed
StephaneDelcroix wants to merge 3 commits intomainfrom
Closed
[XSG] Make AppThemeBinding class public in net11#32678StephaneDelcroix wants to merge 3 commits intomainfrom
StephaneDelcroix wants to merge 3 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR makes the AppThemeBinding class public to resolve XamlSourceGenerator accessibility issues. When XamlSourceGenerator is enabled, it needs to instantiate AppThemeBinding, but the class was marked as internal, causing compilation errors.
Key Changes:
- Changed
AppThemeBindingclass access modifier frominternaltopublic - Updated PublicAPI.Unshipped.txt files across all platform targets to reflect the newly public API surface
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Controls/src/Core/AppThemeBinding.cs | Changed class access modifier from internal to public |
| src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt | Added public API declarations for netstandard target |
| src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt | Added public API declarations for net target |
| src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt | Added public API declarations for net-windows target |
| src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt | Added public API declarations for net-tizen target |
| src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt | Added public API declarations for net-maccatalyst target |
| src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt | Added public API declarations for net-ios target |
| src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt | Added public API declarations for net-android target |
Fixes #32665 The AppThemeBinding class needs to be public for XamlSourceGenerator to access it when generating code. This change makes the class and its constructor public, along with updating all PublicAPI.Unshipped.txt files.
d8aeb9c to
1b29160
Compare
- Move AppThemeBinding from Microsoft.Maui.Controls to Microsoft.Maui.Controls.Internals namespace - Add conditional visibility: public in NET11+, internal before NET11 - SourceGen only registers AppThemeBindingExtension under NET11_0_OR_GREATER - Update all internal references to use new namespace - Clean PublicAPI files (entries will be added when NET11 ships) - Add comprehensive conditional tests in AppThemeBindingConditionalTests.cs - Wrap existing AppThemeBinding SourceGen tests in NET11_0_OR_GREATER - Update namespace references in test expectations This is a non-breaking change: AppThemeBinding remains internal on NET10, becomes public API on NET11+. All tests passing: - SourceGen.UnitTests: 62 passed - Xaml.UnitTests: 1713 passed
1b29160 to
0ffdaec
Compare
…Binding test AppThemeBinding is now only public in NET11_0_OR_GREATER, so the test that directly instantiates it needs to be conditional to avoid build errors in .NET 10.0.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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!
Description of Change
Makes the
AppThemeBindingclass public to fix accessibility issues with XamlSourceGenerator.WARNING: THIS CONTAINS A NEW API in net11
Issues Fixed
Fixes #32665
Background
When XamlSourceGenerator is enabled, it generates code that needs to instantiate
AppThemeBinding. However, the class was marked asinternal, causing compilation errors:Changes
AppThemeBindingclass frominternaltopublicTesting