Skip to content

Use non-generic RefreshAsync in samples when they move to CSLA 11 #4961

Open

Description

@rockfordlhotka

#1766 (PR #4960) makes the XAML ViewModelBase<T>.RefreshAsync<F>(Func<Task<T?>>) overload obsolete, because its F type parameter was never used. Use RefreshAsync(Func<Task<T?>>) instead.

The samples pin published CSLA 10 packages, which have only the generic overload, so they can't switch yet. When the samples are moved to CSLA 11, replace these calls:

  • Samples/AvaloniaExample/CslaAvaloniaExample/Views/PersonEditPage.axaml.cs
  • Samples/AvaloniaExample/CslaAvaloniaExample/Views/PersonListPage.axaml.cs
  • Samples/MauiExample/MauiExample/Pages/PersonEditPage.xaml.cs (2 calls)
  • Samples/MauiExample/MauiExample/Pages/PersonListPage.xaml.cs
  • Samples/SimpleNTier/WpfUI/OrderVm.cs
  • Samples/WpfExample/WpfExample/Pages/PersonEditPage.xaml.cs
  • Support/Templates/content/CslaWpf-CSharp/Wpf/Pages/PersonEditPage.xaml.cs

Also review the XAML samples for other behavior changes from #1766:

  • SaveAsync and RefreshAsync capture exceptions in Exception/ViewModelErrorText instead of throwing.
  • On MAUI and Avalonia, ManageObjectLifetime now defaults to true.

Activity

  1. rockfordlhotka commented on Oct 19, 2026

    @rockfordlhotka
    MemberAuthor

    From the review of #4960: when the samples move to CSLA 11, these pages also need a change, because SaveAsync no longer throws.

    • Samples/MauiExample/MauiExample/Pages/PersonEditPage.xaml.cs and Samples/AvaloniaExample/CslaAvaloniaExample/Views/PersonEditPage.axaml.cs navigate away after await vm.SaveAsync(). After a failed or invalid save they would now leave the page, and the user's edits would be lost without any message. Check vm.Exception and vm.ViewModelErrorText before navigating. The upgrade doc has a before/after snippet.
    • Samples/SimpleNTier/WpfUI/OrderVm.cs wraps SaveAsync in a try/catch that no longer fires. Handle Error, or check Exception afterwards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions