From 7e80f74b10bef2304ff92c0f296cbc7e3e120363 Mon Sep 17 00:00:00 2001 From: Nate Bross Date: Wed, 22 Apr 2026 19:46:27 -0500 Subject: [PATCH 1/5] feat: upgrade to Avalonia 12 Bump Avalonia core packages from 11.2.4 to 12.0.1 and port ClipboardService to the new IAsyncDataTransfer / DataFormat API. - SetTextAsync: now an extension method in Avalonia.Input.Platform. - SetDataAsync: build a DataTransfer with a DataTransferItem holding a DataFormat.CreateBytesPlatformFormat(format) value, then SetDataAsync. - GetFormatsAsync: read DataFormat[] via GetDataFormatsAsync and expose their string Identifier to keep IClipboardService's shape. - GetDataAsync: TryGetDataAsync returns a disposable IAsyncDataTransfer; pull the value for the requested format and dispose. Pin Avalonia.Controls.DataGrid to 12.0.0 explicitly to override the stale 11.1.0 transitive that ships via AvaloniaEdit and can't parse v12 bindings. Avalonia.Diagnostics has no 12.x release; 11.3.14 is the last maintained version and restores cleanly alongside 12.0.1. It remains Debug-only gated in the csproj. --- Directory.Packages.props | 21 ++++++++------- src/SharpFM/Services/ClipboardService.cs | 33 ++++++++++++++---------- src/SharpFM/SharpFM.csproj | 1 + 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 90d8b0d..72b7826 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,15 +4,18 @@ - - - - - - - - - + + + + + + + + + + + diff --git a/src/SharpFM/Services/ClipboardService.cs b/src/SharpFM/Services/ClipboardService.cs index 82e4133..a4e550f 100644 --- a/src/SharpFM/Services/ClipboardService.cs +++ b/src/SharpFM/Services/ClipboardService.cs @@ -1,9 +1,10 @@ using System; using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Input; -using FluentAvalonia.UI.Data; +using Avalonia.Input.Platform; namespace SharpFM.Services; @@ -19,31 +20,35 @@ public ClipboardService(Window window) public async Task SetTextAsync(string text) { - var clipboard = _window.Clipboard - ?? throw new InvalidOperationException("Clipboard is not available."); + var clipboard = GetClipboard(); await clipboard.SetTextAsync(text); } public async Task SetDataAsync(string format, byte[] data) { - var clipboard = _window.Clipboard - ?? throw new InvalidOperationException("Clipboard is not available."); - var dp = new DataPackage(); - dp.SetData(format, data); - await clipboard.SetDataObjectAsync(dp); + var clipboard = GetClipboard(); + var dataFormat = DataFormat.CreateBytesPlatformFormat(format); + var transfer = new DataTransfer(); + transfer.Add(DataTransferItem.Create(dataFormat, data)); + await clipboard.SetDataAsync(transfer); } public async Task GetFormatsAsync() { - var clipboard = _window.Clipboard - ?? throw new InvalidOperationException("Clipboard is not available."); - return await clipboard.GetFormatsAsync(); + var clipboard = GetClipboard(); + var formats = await clipboard.GetDataFormatsAsync(); + return formats.Select(f => f.Identifier).ToArray(); } public async Task GetDataAsync(string format) { - var clipboard = _window.Clipboard - ?? throw new InvalidOperationException("Clipboard is not available."); - return await clipboard.GetDataAsync(format); + var clipboard = GetClipboard(); + using var transfer = await clipboard.TryGetDataAsync(); + if (transfer is null) return null; + var dataFormat = DataFormat.CreateBytesPlatformFormat(format); + return await transfer.TryGetValueAsync(dataFormat); } + + private IClipboard GetClipboard() => + _window.Clipboard ?? throw new InvalidOperationException("Clipboard is not available."); } diff --git a/src/SharpFM/SharpFM.csproj b/src/SharpFM/SharpFM.csproj index c50a006..5a5e6b7 100644 --- a/src/SharpFM/SharpFM.csproj +++ b/src/SharpFM/SharpFM.csproj @@ -57,6 +57,7 @@ + From e3dbde81005424f2c0c06e61c07236fb9658ad13 Mon Sep 17 00:00:00 2001 From: Nate Bross Date: Wed, 22 Apr 2026 19:54:35 -0500 Subject: [PATCH 2/5] chore: drop Avalonia diagnostics package Avalonia 12 removed in-process DevTools. The replacement (AvaloniaUI.DiagnosticsSupport + external AvaloniaUI Developer Tools app) requires a paid license we don't have, and the previous Avalonia.Diagnostics 11.3.14 crashes at runtime when F12 attaches against the 12.x core. Drop the reference entirely rather than ship a dead F12 binding. --- .gitignore | 1 + Directory.Packages.props | 3 --- src/SharpFM/SharpFM.csproj | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 3e759b7..04d0095 100644 --- a/.gitignore +++ b/.gitignore @@ -328,3 +328,4 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ +.claude/ diff --git a/Directory.Packages.props b/Directory.Packages.props index 72b7826..ae17a8a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,9 +9,6 @@ - - diff --git a/src/SharpFM/SharpFM.csproj b/src/SharpFM/SharpFM.csproj index 5a5e6b7..783ea21 100644 --- a/src/SharpFM/SharpFM.csproj +++ b/src/SharpFM/SharpFM.csproj @@ -65,10 +65,6 @@ - - From 2925122da75510add812432663c7d7ba98a0a7e9 Mon Sep 17 00:00:00 2001 From: Nate Bross Date: Wed, 22 Apr 2026 20:13:28 -0500 Subject: [PATCH 3/5] chore: remove .claude/ from gitignore Accidentally added in e3dbde8; should stay out of the repo's gitignore so each contributor can decide what to ignore via their personal global gitignore or a local exclude. --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 04d0095..4ae580f 100644 --- a/.gitignore +++ b/.gitignore @@ -326,6 +326,5 @@ ASALocalRun/ # NVidia Nsight GPU debugger configuration file *.nvuser -# MFractors (Xamarin productivity tool) working folder +# MFractors (Xamarin productivity tool) working folder .mfractor/ -.claude/ From 894642b4a14062386960b0bdf9aac550f1a3915f Mon Sep 17 00:00:00 2001 From: Nate Bross Date: Wed, 22 Apr 2026 21:23:53 -0500 Subject: [PATCH 4/5] chore: drop unused Avalonia.Xaml.Interactions reference --- Directory.Packages.props | 1 - src/SharpFM/SharpFM.csproj | 1 - 2 files changed, 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index ae17a8a..1f8fedd 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,7 +9,6 @@ - diff --git a/src/SharpFM/SharpFM.csproj b/src/SharpFM/SharpFM.csproj index 783ea21..ccfd308 100644 --- a/src/SharpFM/SharpFM.csproj +++ b/src/SharpFM/SharpFM.csproj @@ -59,7 +59,6 @@ - From ad721e2b19dfe87e7fd5cd38e2900c8d6f0f37d7 Mon Sep 17 00:00:00 2001 From: Nate Bross Date: Wed, 22 Apr 2026 21:39:43 -0500 Subject: [PATCH 5/5] chore: drop unused FluentAvaloniaUI reference --- Directory.Packages.props | 1 - src/SharpFM.Plugin.Sample/SharpFM.Plugin.Sample.csproj | 1 - src/SharpFM.Plugin.XmlViewer/SharpFM.Plugin.XmlViewer.csproj | 1 - src/SharpFM/SharpFM.csproj | 1 - 4 files changed, 4 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1f8fedd..7dff228 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,7 +12,6 @@ - diff --git a/src/SharpFM.Plugin.Sample/SharpFM.Plugin.Sample.csproj b/src/SharpFM.Plugin.Sample/SharpFM.Plugin.Sample.csproj index e305001..491d79f 100644 --- a/src/SharpFM.Plugin.Sample/SharpFM.Plugin.Sample.csproj +++ b/src/SharpFM.Plugin.Sample/SharpFM.Plugin.Sample.csproj @@ -18,7 +18,6 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/SharpFM.Plugin.XmlViewer/SharpFM.Plugin.XmlViewer.csproj b/src/SharpFM.Plugin.XmlViewer/SharpFM.Plugin.XmlViewer.csproj index 74c6f2f..f78149e 100644 --- a/src/SharpFM.Plugin.XmlViewer/SharpFM.Plugin.XmlViewer.csproj +++ b/src/SharpFM.Plugin.XmlViewer/SharpFM.Plugin.XmlViewer.csproj @@ -21,7 +21,6 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/SharpFM/SharpFM.csproj b/src/SharpFM/SharpFM.csproj index ccfd308..e006680 100644 --- a/src/SharpFM/SharpFM.csproj +++ b/src/SharpFM/SharpFM.csproj @@ -64,7 +64,6 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive