[AdvancedPaste] Harden ToJsonFromXmlOrCsvAsync against clipboard read failures (#48124)
## Summary `ToJsonFromXmlOrCsvAsync` in `AdvancedPaste/Helpers/JsonHelper.cs` documents that it never throws and returns an empty string on any failure. The clipboard read at the top of the method (`clipboardData.GetTextAsync()`) was not wrapped, so a transient clipboard failure could surface as an exception to callers, contrary to the documented contract. This PR: - Wraps `GetTextAsync()` in a try/catch and returns `string.Empty` on failure, matching the pattern already used by the JSON/XML/CSV parsing branches further down in the same method. - Updates the matching unit test to decode input bytes as UTF-8 (`Encoding.UTF8.GetString(input)`) and consume the awaited task via `GetAwaiter().GetResult()`, for consistency with sibling tests elsewhere in the solution. ## Validation - Local build of `AdvancedPaste.sln`. (Note: my machine has a pre-existing NuGet SDK resolver issue unrelated to this change — the same baseline fails on `main` for me. CI should be the source of truth.) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
G
Gordon Lam committed
85b9191b7c62233960eb430904d1ce68acc10caf
Parent: cb17421
Committed by GitHub <noreply@github.com>
on 5/26/2026, 2:59:24 AM