Skip to content

Avalonia 12 support #379

Description

@supermomonga

Avalonia 12 has been released with several breaking changes:
https://docs.avaloniaui.net/docs/avalonia12-breaking-changes

I would like to discuss how R3.Avalonia should support Avalonia 12.

Impact on R3.Avalonia

The most important breaking change for this project seems to be the target framework support.

Avalonia 12 dropped support for .NET Framework and .NET Standard. It only supports .NET 8 and later, with .NET 10 recommended.

Currently, R3.Avalonia targets:

<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>

and references:

<PackageReference Include="Avalonia" Version="11.0.0" />

I tested replacing the Avalonia package reference with 12.0.3 locally. The net8.0 target builds successfully, but the full multi-target build fails because Avalonia 12 does not provide assets for netstandard2.0, netstandard2.1, or net6.0.

I did not find direct usage of removed Avalonia 12 APIs in the current R3.Avalonia code. Most breaking changes such as binding hierarchy changes, clipboard changes, gesture events, focus event args, window decoration APIs, and platform-specific changes do not appear to affect this project directly.

One behavioral point worth considering is Avalonia 12's multiple dispatcher support. DispatcherTimer now uses Dispatcher.CurrentDispatcher by default, and the migration guide recommends that library/control authors avoid assuming Dispatcher.UIThread where possible. R3.Avalonia currently creates DispatcherTimer instances without explicitly passing a dispatcher, so it may be worth deciding whether to add dispatcher-aware overloads as part of Avalonia 12 support.

Decision needed

What support strategy should R3 use for Avalonia 12?

Possible options I think:

  1. Update the existing R3.Avalonia package to Avalonia 12 and drop unsupported target frameworks.
  2. Keep the existing Avalonia 11 package as-is (R3.Avalonia) and add a separate Avalonia 12 package/project asR3.Avalonia12.
  3. Rename the existing Avalonia 11 package as R3.Avalonia11 and add a separate Avalonia 12 package/project as R3.Avalonia12.
  4. Rename the existing Avalonia 11 package as R3.Avalonia11 and add a separate Avalonia 12 package/project as R3.Avalonia.
  5. Multi-target conditionally, keeping Avalonia 11 support for older TFMs and Avalonia 12 support for net8.0 or later.
  6. Another approach preferred by the maintainers.

Once the desired direction is decided, I can send a pull request implementing the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions