Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 20, 2025

CommunityToolkit.Mvvm 8.4.0 enforces stricter rules against directly accessing [ObservableProperty] backing fields, causing a build warning in SettingsViewModel.cs.

Changes

  • Added _isLoading flag to prevent OnThemeChanged callback during settings initialization
  • Updated LoadSettings() to use generated Theme property instead of _theme field
  • Wrapped flag in try-finally for proper cleanup on exceptions
partial void OnThemeChanged(string value)
{
    if (_isLoading) return;
    App.Instance?.ApplyTheme(value);
}

private void LoadSettings()
{
    try
    {
        _isLoading = true;
        Theme = Preferences.Theme; // Uses property, not _theme field
        // ...
    }
    finally
    {
        _isLoading = false;
    }
}

This maintains the original behavior of skipping theme preview during load while complying with the toolkit's code generation patterns.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copy link
Contributor Author

Copilot AI commented Dec 20, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update CommunityToolkit.Mvvm to version 8.4.0 Fix MVVMTK0034 warning from CommunityToolkit.Mvvm 8.4.0 upgrade Dec 20, 2025
Copilot AI requested a review from soliktomasz December 20, 2025 18:19
@soliktomasz soliktomasz marked this pull request as ready for review December 20, 2025 18:21
@soliktomasz soliktomasz merged commit f59d2de into dependabot/nuget/CommunityToolkit.Mvvm-8.4.0 Dec 20, 2025
@soliktomasz soliktomasz deleted the copilot/sub-pr-6 branch December 21, 2025 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants