Skip to content

chore: Upgrade Avalonia to 12.0 and migrate codebase#1673

Draft
yuto-trd wants to merge 30 commits into
mainfrom
yuto-trd/migrate-avalonia-12
Draft

chore: Upgrade Avalonia to 12.0 and migrate codebase#1673
yuto-trd wants to merge 30 commits into
mainfrom
yuto-trd/migrate-avalonia-12

Conversation

@yuto-trd

Copy link
Copy Markdown
Member

Description

  • Upgrade Avalonia from 11.x to 12.0 and update related dependencies across the solution (Directory.Packages.props, csproj files).
  • Migrate codebase to Avalonia 12 APIs: ReflectionBinding for dynamic bindings, x:DataType for compiled bindings, PlaceholderText, FocusChangedEventArgs, Math.Clamp, Avalonia.Input.Platform namespace, logical-tree traversal, and TopLevel-based scaling.
  • Replace Avalonia.Diagnostics with AvaloniaUI.DiagnosticsSupport (WithDeveloperTools()), remove the custom BcTabItem/BcTabView/DirectoryTreeView controls, and migrate UI to FluentAvalonia (FA) components including the renamed Beutl.FluentIcons.FluentAvalonia package.
  • Drop the obsolete DirectoryViewTest project and adjust several window/editor views (styles, drag handling, IListEditorViewModel.IsEnabled, etc.) for consistency under the new framework.

Breaking changes

  • Extensions depending on the custom BcTabItem/BcTabView or DirectoryTreeView controls must migrate to the FluentAvalonia equivalents, since these controls were removed.
  • Extensions referencing the FluentIcons.FluentAvalonia package must switch to Beutl.FluentIcons.FluentAvalonia.
  • Targeting Avalonia 12 means extensions must be recompiled against the new Avalonia 12 API surface.

Fixed issues

None

@yuto-trd
yuto-trd force-pushed the yuto-trd/migrate-avalonia-12 branch 2 times, most recently from 49ae40e to c71c40c Compare April 27, 2026 08:19
@yuto-trd
yuto-trd force-pushed the yuto-trd/migrate-avalonia-12 branch from c71c40c to ac43186 Compare June 6, 2026 15:55
// needs to know the exact types at compile time.

[DllImport("/usr/lib/libobjc.A.dylib")]
private static extern IntPtr objc_getClass(string name);
private static extern IntPtr objc_getClass(string name);

[DllImport("/usr/lib/libobjc.A.dylib")]
private static extern IntPtr sel_registerName(string name);
private static extern IntPtr sel_registerName(string name);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern IntPtr objc_msgSend_ret(IntPtr receiver, IntPtr selector);
private static extern IntPtr objc_msgSend_ret(IntPtr receiver, IntPtr selector);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern void objc_msgSend_arg(IntPtr receiver, IntPtr selector, IntPtr arg);
private static extern void objc_msgSend_arg(IntPtr receiver, IntPtr selector, IntPtr arg);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern IntPtr objc_msgSend_arg_ret(IntPtr receiver, IntPtr selector, IntPtr arg);
private static extern IntPtr objc_msgSend_arg_ret(IntPtr receiver, IntPtr selector, IntPtr arg);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern void objc_msgSend_bool(IntPtr receiver, IntPtr selector, [MarshalAs(UnmanagedType.I1)] bool arg);
private static extern void objc_msgSend_bool(IntPtr receiver, IntPtr selector, [MarshalAs(UnmanagedType.I1)] bool arg);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern void objc_msgSend_long(IntPtr receiver, IntPtr selector, long arg);

// remove the toolbar to restore the default thin title bar
if (_nsWindow != IntPtr.Zero && _selSetToolbar != IntPtr.Zero)
objc_msgSend_arg(_nsWindow, _selSetToolbar, IntPtr.Zero);

// 2. cache ObjC selectors used during setup and fullscreen transitions.
// sel_registerName returns a stable pointer for the lifetime of the process.
_selSetToolbar = sel_registerName("setToolbar:");
// 2. cache ObjC selectors used during setup and fullscreen transitions.
// sel_registerName returns a stable pointer for the lifetime of the process.
_selSetToolbar = sel_registerName("setToolbar:");
_selSetTitlebarAppearsTransparent = sel_registerName("setTitlebarAppearsTransparent:");
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a1f09e1-cdcf-405c-9e01-b057f4e95762

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yuto-trd/migrate-avalonia-12

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yuto-trd
yuto-trd force-pushed the yuto-trd/migrate-avalonia-12 branch from b369dbe to cefcc81 Compare June 22, 2026 16:56
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
Beutl.Api 0% 0% 1160
Beutl.Configuration 41% 22% 350
Beutl.Controls 0% 0% 5336
Beutl.Core 62% 56% 3069
Beutl.Editor 78% 70% 1734
Beutl.Editor.Components 0% 0% 8548
Beutl.Embedding.MediaFoundation 4% 1% 1354
Beutl.Engine 60% 50% 18071
Beutl.Extensibility 38% 59% 112
Beutl.Extensions.AVFoundation 5% 12% 246
Beutl.Extensions.FFmpeg 5% 5% 856
Beutl.FFmpegIpc 22% 27% 799
Beutl.Language 7% 50% 1348
Beutl.NodeGraph 24% 15% 2474
Beutl.ProjectSystem 58% 43% 1061
Beutl.Threading 100% 90% 137
Beutl.Utilities 94% 87% 358
Summary 33% (40807 / 122650) 29% (10236 / 34730) 47013

Minimum allowed line rate is 0%

yuto-trd added 23 commits July 12, 2026 22:07
…base

main側で追加された新規コードがリベース後も移行前のAPIを参照していたため修正:
- FluentAvalonia 3.0 のFA接頭辞付き型へ移行
  (ContentDialog/IconSource/PickerFlyoutBase/SymbolIcon 等 -> FA*)
- Avalonia 12 で非公開化した Visual.GetVisualRoot() を
  IsAttachedToVisualTree() へ置換

対象: WindowCaptureDialog, CrashRecoveryPromptTask, ToolWindowExtension,
ExtensionsToolWindowExtension, OutputPickerFlyoutPresenter, HistoryView,
MarkerEditFlyout, OutputPickerFlyout, OutputTab, MainView,
CommandPaletteView, SampleToolWindowExtension
yuto-trd added 5 commits July 12, 2026 22:12
- FluentAvaloniaUI: 3.0.0-preview4 -> 3.0.0
- AvaloniaUI.DiagnosticsSupport: 2.2.2 -> 2.2.3
- Svg.Controls.Skia.Avalonia: 12.0.0.11 -> 12.0.0.13

Claude-Session: https://claude.ai/code/session_01RJjpa89ubCWUGqXcPzb4oS
… rebase

The 003 pipeline (#1886) added SaveFrameDialog and the frame-save context menu
against FluentAvalonia's ContentDialog, but this branch had already migrated
dialogs to FAContentDialog (FluentAvalonia 3.0). The rebase replayed that
migration under the newer code, so update these call sites to
FAContentDialog/FAContentDialogResult to match the other dialogs.

Claude-Session: https://claude.ai/code/session_01GJAqiaJzpB1pQFqnQhMoEf
@yuto-trd
yuto-trd force-pushed the yuto-trd/migrate-avalonia-12 branch 2 times, most recently from b6a1014 to e69347e Compare July 12, 2026 14:12
@yuto-trd
yuto-trd force-pushed the yuto-trd/migrate-avalonia-12 branch from e69347e to cc1f40c Compare July 12, 2026 14:14

@drift-check drift-check Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Bot flagged 1 possible comment/code divergence(s). These are advisory.

Results are for commit cc1f40c. On newer commits, the bot's summary comment reflects the latest run.

Comment on lines +58 to +59
added 1px left margin, otherwise we can get strange artifacts while
animating, I'm guessing from bad invalidation rects?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment may no longer match the code (info)

The comment states a 1px left margin was added, but the actual code has a left margin of 2 (Margin="2,0,0,0").

Current comment:

added 1px left margin, otherwise we can get strange artifacts while
animating, I'm guessing from bad invalidation rects?

Suggested update:

added 2px left margin, otherwise we can get strange artifacts while
animating, I'm guessing from bad invalidation rects?

@drift-check

drift-check Bot commented Jul 12, 2026

Copy link
Copy Markdown

Code Review Bot

No comment/code divergences or documentation drift detected. Reviewed 98 file(s); skipped 103.

@github-actions

Copy link
Copy Markdown
Contributor

No TODO comments were found.

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.

1 participant