CommunityToolkit / CommunityToolkit/Maui
[BUG] AppThemeResource / AppThemeColor do not update on theme change in Release mode
- Dominant language
- C#
- Stars
- 2.7k
- Forks
- 500
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 7
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Did you read the "Reporting a bug" section on Contributing file?
- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
### Current Behavior
After upgrading to CommunityToolkit.Maui 15.0.0 (and 15.0.1), colors defined through AppThemeResource and AppThemeColor no longer update when switching between Light and Dark mode in Release builds. This has been reproduced on both Android and iOS.
The same code works correctly in:
- Debug builds
- Older CommunityToolkit.Maui versions
- When using AppThemeBinding directly instead of AppThemeResource / AppThemeColor
### Expected Behavior
The colors should be updated when the system theme changes.
### Steps To Reproduce
1. Open solution from repo
2. Run app in simulator in release mode
3. Observe the background color of the page is not updated when toggle light/dark mode.
When running same app in debug mode, all is well
### Link to public reproduction project repository
https://github.com/zwikk/maui-playground/tree/main/Source/AppThemeBindingTest
### Environment
```markdown
- .NET MAUI CommunityToolkit: 15.0.0 and 15.0.1
- OS: iOS 16+, Android API 36
- .NET MAUI: 10.0.100
```
### Anything else?
_No response_
Contributor guide
Research direction
Start with the public reproduction project at Source/AppThemeBindingTest and run it in Release mode on a simulator. Compare AppThemeResource and AppThemeColor behavior with Debug mode and direct AppThemeBinding; done means the colors update when switching between Light and Dark mode in Release builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, csharp, ios
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100