diff --git a/NAPS2.App.Tests/NAPS2.App.Tests.csproj b/NAPS2.App.Tests/NAPS2.App.Tests.csproj index 8a1f3eb526..336263359d 100644 --- a/NAPS2.App.Tests/NAPS2.App.Tests.csproj +++ b/NAPS2.App.Tests/NAPS2.App.Tests.csproj @@ -1,7 +1,8 @@ - net8 + net8-windows + net8 true None Debug;Release;DebugLang diff --git a/NAPS2.Images/ImageContext.cs b/NAPS2.Images/ImageContext.cs index 78f19fb6b4..49a56f1400 100644 --- a/NAPS2.Images/ImageContext.cs +++ b/NAPS2.Images/ImageContext.cs @@ -245,7 +245,7 @@ public IMemoryImage RenderWithoutTransforms(IRenderableImage image) return RenderFromStorage(image.Storage, (image as IPdfRendererProvider)?.PdfRenderer); } - private IMemoryImage RenderFromStorage(IImageStorage storage, IPdfRenderer pdfRenderer) + private IMemoryImage RenderFromStorage(IImageStorage storage, IPdfRenderer? pdfRenderer) { switch (storage) { diff --git a/NAPS2.Images/ImageExtensions.cs b/NAPS2.Images/ImageExtensions.cs index e54f515113..8f732e9c09 100644 --- a/NAPS2.Images/ImageExtensions.cs +++ b/NAPS2.Images/ImageExtensions.cs @@ -16,8 +16,7 @@ public static IMemoryImage Render(this IRenderableImage image) /// /// /// - internal static bool IsUntransformedJpegFile(this IRenderableImage image, - [MaybeNullWhen(false)] out string jpegPath) + internal static bool IsUntransformedJpegFile(this IRenderableImage image, out string jpegPath) { if (image is { Storage: ImageFileStorage fileStorage, TransformState.IsEmpty: true } && ImageContext.GetFileFormatFromExtension(fileStorage.FullPath) == ImageFileFormat.Jpeg) @@ -25,7 +24,7 @@ internal static bool IsUntransformedJpegFile(this IRenderableImage image, jpegPath = fileStorage.FullPath; return true; } - jpegPath = null; + jpegPath = null!; return false; } diff --git a/NAPS2.Images/NAPS2.Images.csproj b/NAPS2.Images/NAPS2.Images.csproj index 1e739199b7..9cc3f1d347 100644 --- a/NAPS2.Images/NAPS2.Images.csproj +++ b/NAPS2.Images/NAPS2.Images.csproj @@ -18,7 +18,6 @@ - diff --git a/NAPS2.Internals/Threading/AsyncProducers.cs b/NAPS2.Internals/Threading/AsyncProducers.cs index 09f3d705cf..c7a58bf248 100644 --- a/NAPS2.Internals/Threading/AsyncProducers.cs +++ b/NAPS2.Internals/Threading/AsyncProducers.cs @@ -3,6 +3,7 @@ namespace NAPS2.Util; public static class AsyncProducers { +#pragma warning disable CS1998 public static async IAsyncEnumerable Empty() { yield break; diff --git a/NAPS2.Lib.Gtk/Util/GLibLogInterceptor.cs b/NAPS2.Lib.Gtk/Util/GLibLogInterceptor.cs index 5862215697..1fffeca5ba 100644 --- a/NAPS2.Lib.Gtk/Util/GLibLogInterceptor.cs +++ b/NAPS2.Lib.Gtk/Util/GLibLogInterceptor.cs @@ -75,6 +75,7 @@ private delegate void GLogWriterFunc( nint nFields, IntPtr user_data); + [StructLayout(LayoutKind.Sequential)] struct GLogField { public string key; diff --git a/NAPS2.Lib.WinForms/EtoForms/Ui/WinFormsDesktopForm.cs b/NAPS2.Lib.WinForms/EtoForms/Ui/WinFormsDesktopForm.cs index c770f8741d..bc865bf26e 100644 --- a/NAPS2.Lib.WinForms/EtoForms/Ui/WinFormsDesktopForm.cs +++ b/NAPS2.Lib.WinForms/EtoForms/Ui/WinFormsDesktopForm.cs @@ -169,7 +169,7 @@ protected override void UpdateProfilesToolbar() TextAlign = ContentAlignment.MiddleLeft, Image = Image.FromStream(new MemoryStream(Icons.control_play_blue_small)) }; - item.Click += (_, _) => _desktopScanController.ScanWithProfile((ScanProfile) item.Tag); + item.Click += (_, _) => _desktopScanController.ScanWithProfile((ScanProfile) item.Tag!); toolbarItems.Add(item); } for (int i = 0; i < profiles.Count; i++) diff --git a/NAPS2.Lib/EtoForms/Ui/OcrSetupForm.cs b/NAPS2.Lib/EtoForms/Ui/OcrSetupForm.cs index 88b4f06120..27108cbf17 100644 --- a/NAPS2.Lib/EtoForms/Ui/OcrSetupForm.cs +++ b/NAPS2.Lib/EtoForms/Ui/OcrSetupForm.cs @@ -143,7 +143,7 @@ private void MoreLanguages_Click(object? sender, EventArgs e) LoadLanguages(); } - private void OcrLang_SelectedIndexChanged(object sender, EventArgs e) + private void OcrLang_SelectedIndexChanged(object? sender, EventArgs e) { if (_suppressLangChangeEvent) return; if (_ocrLang.SelectedIndex == _ocrLang.Items.Count - 1) diff --git a/NAPS2.Lib/Scan/ScanPerformer.cs b/NAPS2.Lib/Scan/ScanPerformer.cs index b0714f0524..46c191f019 100644 --- a/NAPS2.Lib/Scan/ScanPerformer.cs +++ b/NAPS2.Lib/Scan/ScanPerformer.cs @@ -236,10 +236,10 @@ private ScanOptions BuildOptions(ScanProfile scanProfile, ScanParams scanParams, : TwainTransferMode.Native, ShowProgress = scanProfile.TwainProgress, IncludeWiaDevices = false - // TODO: Consider adding a user option for TwainOptions.ShowProgress instead of our progress window }, SaneOptions = { + // We use a worker process for SANE so we should clean up after each operation KeepInitialized = false }, KeyValueOptions = scanProfile.KeyValueOptions != null diff --git a/NAPS2.Sdk.ScannerTests/NAPS2.Sdk.ScannerTests.csproj b/NAPS2.Sdk.ScannerTests/NAPS2.Sdk.ScannerTests.csproj index b964c098b7..1cafcea3c2 100644 --- a/NAPS2.Sdk.ScannerTests/NAPS2.Sdk.ScannerTests.csproj +++ b/NAPS2.Sdk.ScannerTests/NAPS2.Sdk.ScannerTests.csproj @@ -1,7 +1,7 @@ - net8;net462 + net8-windows;net462 net8 NAPS2.Sdk.ScannerTests diff --git a/NAPS2.Sdk.Tests/Pdf/PdfFontTests.cs b/NAPS2.Sdk.Tests/Pdf/PdfFontTests.cs index dc1fa164c4..a5d9d91459 100644 --- a/NAPS2.Sdk.Tests/Pdf/PdfFontTests.cs +++ b/NAPS2.Sdk.Tests/Pdf/PdfFontTests.cs @@ -9,6 +9,9 @@ namespace NAPS2.Sdk.Tests.Pdf; +// As we use the same data for multiple methods, some parameters may be unused +#pragma warning disable xUnit1026 + public class PdfFontTests : ContextualTests { private readonly PdfImporter _importer; @@ -36,7 +39,7 @@ public void CheckAvailableFonts() [Theory] [MemberData(nameof(AlphabetTestCases))] - internal async Task MapLanguageCodeToAlphabet(Alphabet alphabet, string langCode, string text, bool rtl) + internal void MapLanguageCodeToAlphabet(Alphabet alphabet, string langCode, string text, bool rtl) { Assert.Equal(alphabet, PdfFontPicker.MapLanguageCodeToAlphabet(langCode)); }