Repository: microsoft/PowerToys
File: src/modules/peek/Peek.FilePreviewer/Previewers/UnsupportedFilePreviewer/UnsupportedFilePreviewer.cs (C#)

Code before:
        {
            try
            {
                await Dispatcher.RunOnUiThread(async () =>
                {
                    Preview.FileName = Item.Name;
                    Preview.DateModified = Item.DateModified?.ToString(CultureInfo.CurrentCulture);

                    State = PreviewState.Loaded;

                    await LoadIconPreviewAsync(cancellationToken);
                });

                var progress = new Progress<string?>(update =>
                {
                    Dispatcher.TryEnqueue(() =>
                    {
                        Preview.FileSize = update;
                    });
                });

                await LoadDisplayInfoAsync(progress, cancellationToken);
            }
            catch (OperationCanceledException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.LogError($"UnsupportedFilePreviewer error. {ex.Message}");
                State = PreviewState.Error;
            }
        }

        public async Task CopyAsync()
        {
            await Dispatcher.RunOnUiThread(async () =>
            {
                var storageItem = await Item.GetStorageItemAsync();
                ClipboardHelper.SaveToClipboard(storageItem);
            });
        }

        private async Task LoadIconPreviewAsync(CancellationToken cancellationToken)
        {
            Preview.IconPreview = await ThumbnailHelper.GetThumbnailAsync(Item.Path, cancellationToken) ??
                await ThumbnailHelper.GetIconAsync(Item.Path, cancellationToken) ??
                DefaultIcon;
        }

        private async Task LoadDisplayInfoAsync(IProgress<string?> sizeProgress, CancellationToken cancellationToken)

Review comment (suggestion):
```suggestion
```
Let's avoid rethrow this since it's a cancellation.

Code after:
        }

        private IFileSystemItem Item { get; }

        private DispatcherQueue Dispatcher { get; }

        public Task<PreviewSize> GetPreviewSizeAsync(CancellationToken cancellationToken) =>
            Task.FromResult(new PreviewSize { MonitorSize = new Size(680, 500), UseEffectivePixels = true });

        public async Task LoadPreviewAsync(CancellationToken cancellationToken)
        {
            try
            {
                await Dispatcher.RunOnUiThread(async () =>
                {
                    Preview.FileName = Item.Name;
                    Preview.DateModified = Item.DateModified?.ToString(CultureInfo.CurrentCulture);

                    State = PreviewState.Loaded;

                    await LoadIconPreviewAsync(cancellationToken);
                });

                var progress = new Progress<string>(update =>
                {
                    Dispatcher.TryEnqueue(() =>
                    {
                        Preview.FileSize = update;
                    });
                });

                await LoadDisplayInfoAsync(progress, cancellationToken);
            }
            catch (OperationCanceledException)
            {
            }
            catch (Exception ex)
            {
                Logger.LogError("UnsupportedFilePreviewer error.", ex);
                State = PreviewState.Error;
            }
        }

        public async Task CopyAsync()
        {
            await Dispatcher.RunOnUiThread(async () =>
            {
                var storageItem = await Item.GetStorageItemAsync();
                ClipboardHelper.SaveToClipboard(storageItem);
            });
        }