From 5a4e4cb01d9d1d465741f85401aaf489f69f4079 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 22 Jan 2026 17:31:33 +0100 Subject: [PATCH 01/65] :arrow_up: bump dependencies for all projects --- src/Mindee.Cli/Mindee.Cli.csproj | 33 +++++++++++++++---- src/Mindee/Mindee.csproj | 28 +++++++--------- .../Mindee.IntegrationTests.csproj | 18 ++++++---- .../Mindee.UnitTests/Mindee.UnitTests.csproj | 30 +++++++++++------ 4 files changed, 69 insertions(+), 40 deletions(-) diff --git a/src/Mindee.Cli/Mindee.Cli.csproj b/src/Mindee.Cli/Mindee.Cli.csproj index 79b608a0..1325ddd7 100644 --- a/src/Mindee.Cli/Mindee.Cli.csproj +++ b/src/Mindee.Cli/Mindee.Cli.csproj @@ -27,15 +27,34 @@ + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/src/Mindee/Mindee.csproj b/src/Mindee/Mindee.csproj index 50e08c21..75ca0ee0 100644 --- a/src/Mindee/Mindee.csproj +++ b/src/Mindee/Mindee.csproj @@ -6,32 +6,26 @@ - - - - - + + + + + - - - - - - - - - - - - + + + + + + diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 1cd32e3f..e54bbd3a 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -9,10 +9,11 @@ - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive @@ -24,8 +25,13 @@ - - + + + + + + + diff --git a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj index 034220a4..938d8419 100644 --- a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj +++ b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj @@ -9,25 +9,35 @@ - - - - - - - - - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all + + + + + + + + + + + + + From b16466d8c4d8c140cf4185a1fee6d797b2d4f1fb Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 23 Jan 2026 12:50:59 +0100 Subject: [PATCH 02/65] bumped libs, tests not working --- Directory.Build.props | 28 +++ src/Mindee.Cli/Commands/PredictCommand.cs | 117 +++++++----- src/Mindee.Cli/Mindee.Cli.csproj | 30 +--- src/Mindee.Cli/Program.cs | 169 ++++++++++-------- src/Mindee/Image/ImageCompressor.cs | 3 +- src/Mindee/Mindee.csproj | 24 --- src/Mindee/Pdf/PdfUtils.cs | 16 +- .../Mindee.IntegrationTests.csproj | 20 +-- .../Mindee.UnitTests/Mindee.UnitTests.csproj | 21 +-- 9 files changed, 216 insertions(+), 212 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2c9edae4..de3d94c1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -41,4 +41,32 @@ true false + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mindee.Cli/Commands/PredictCommand.cs b/src/Mindee.Cli/Commands/PredictCommand.cs index c43154ea..90f471e0 100644 --- a/src/Mindee.Cli/Commands/PredictCommand.cs +++ b/src/Mindee.Cli/Commands/PredictCommand.cs @@ -1,6 +1,4 @@ using System.CommandLine; -using System.CommandLine.Invocation; -using System.CommandLine.IO; using System.Text.Json; using Mindee.Input; using Mindee.Parsing; @@ -31,103 +29,134 @@ class PredictCommand : Command where TPage : IPrediction, new() where TInferenceModel : Inference, new() { + private readonly Option _outputOption; + private readonly Option? _allWordsOption; + private readonly Option? _fullTextOption; + private readonly Option? _asyncOption; + private readonly Argument _pathArgument; + public PredictCommand(CommandOptions options) : base(options.Name, options.Description) { - AddOption(new Option(["-o", "--output", "output"], - "Specify how to output the data. \n" + - "- summary: a basic summary (default)\n" + - "- raw: full JSON object\n")); + _outputOption = new Option("--output", "-o") + { + Description = "Specify how to output the data. \n" + + "- summary: a basic summary (default)\n" + + "- raw: full JSON object\n", + DefaultValueFactory = _ => OutputType.Summary + }; + Options.Add(_outputOption); + if (options.AllWords) { - var option = new Option(["-w", "--all-words", "allWords"], - "To get all the words in the current document. False by default."); - AddOption(option); + _allWordsOption = new Option("--all-words", "-w") + { + Description = "To get all the words in the current document. False by default.", + DefaultValueFactory = _ => false + }; + Options.Add(_allWordsOption); } if (options.FullText) { - var option = new Option(["-f", "--full-text", "fullText"], - "To get all the words in the current document. False by default."); - AddOption(option); + _fullTextOption = new Option("--full-text", "-f") + { + Description = "To get all the words in the current document. False by default.", + DefaultValueFactory = _ => false + }; + Options.Add(_fullTextOption); } switch (options.Async) { case true when !options.Sync: { - // Inject an "option" not changeable by the user. - // This will set the `Handler.Async` property to always be `true`. - var option = new Option("async", () => true) { IsHidden = true }; - AddOption(option); + _asyncOption = new Option("async") + { + Hidden = true, + DefaultValueFactory = _ => true + }; + Options.Add(_asyncOption); break; } case true when options.Sync: - AddOption(new Option(["--async"], - "Process the file asynchronously. False by default.")); + _asyncOption = new Option("--async") + { + Description = "Process the file asynchronously. False by default.", + DefaultValueFactory = _ => false + }; + Options.Add(_asyncOption); break; } - AddArgument(new Argument("path", "The path of the file to parse")); + _pathArgument = new Argument("path") { Description = "The path of the file to parse" }; + Arguments.Add(_pathArgument); } - public new class Handler(MindeeClient mindeeClient) : ICommandHandler + public void ConfigureAction(MindeeClient mindeeClient) { - private readonly JsonSerializerOptions _jsonSerializerOptions = new() { WriteIndented = true }; - - public string Path { get; set; } = null!; - public bool AllWords { get; set; } = false; - public bool FullText { get; set; } = false; - public OutputType Output { get; set; } = OutputType.Full; - public bool Async { get; set; } = false; + this.SetAction(parseResult => + { + var path = parseResult.GetValue(_pathArgument)!; + var allWords = _allWordsOption != null && parseResult.GetValue(_allWordsOption); + var fullText = _fullTextOption != null && parseResult.GetValue(_fullTextOption); + var output = parseResult.GetValue(_outputOption); + var isAsync = _asyncOption != null && parseResult.GetValue(_asyncOption); + + var handler = new Handler(mindeeClient); + return handler.InvokeAsync(path, allWords, fullText, output, isAsync).GetAwaiter().GetResult(); + }); + } - public int Invoke(InvocationContext context) + public class Handler(MindeeClient mindeeClient) + { + private readonly JsonSerializerOptions _jsonSerializerOptions = new() { - return InvokeAsync(context).GetAwaiter().GetResult(); - } + WriteIndented = true, + Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping + }; - public async Task InvokeAsync(InvocationContext context) + public async Task InvokeAsync(string path, bool allWords, bool fullText, OutputType output, bool isAsync) { - var options = - new ParseOptions(Path, AllWords, FullText, Output); - if (Async) + var options = new ParseOptions(path, allWords, fullText, output); + if (isAsync) { - return await EnqueueAndParseAsync(context, options); + return await EnqueueAndParseAsync(options); } - return await ParseAsync(context, options); + return await ParseAsync(options); } - private async Task ParseAsync(InvocationContext context, ParseOptions options) + private async Task ParseAsync(ParseOptions options) { var response = await mindeeClient.ParseAsync( new LocalInputSource(options.Path), - new PredictOptions(AllWords, FullText)); + new PredictOptions(options.AllWords, options.FullText)); if (response == null) { - context.Console.Out.Write("null"); + await Console.Out.WriteAsync("null"); return 1; } - PrintToConsole(context.Console.Out, options, response); + PrintToConsole(Console.Out, options, response); return 0; } - private async Task EnqueueAndParseAsync(InvocationContext context, ParseOptions options) + private async Task EnqueueAndParseAsync(ParseOptions options) { var response = await mindeeClient.EnqueueAndParseAsync( new LocalInputSource(options.Path), - new PredictOptions(AllWords, FullText), + new PredictOptions(options.AllWords, options.FullText), null, new AsyncPollingOptions()); - PrintToConsole(context.Console.Out, options, response); + PrintToConsole(Console.Out, options, response); return 0; } private void PrintToConsole( - IStandardStreamWriter console, + TextWriter console, ParseOptions options, PredictResponse response) { diff --git a/src/Mindee.Cli/Mindee.Cli.csproj b/src/Mindee.Cli/Mindee.Cli.csproj index 1325ddd7..8e1cd10a 100644 --- a/src/Mindee.Cli/Mindee.Cli.csproj +++ b/src/Mindee.Cli/Mindee.Cli.csproj @@ -27,35 +27,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + - - + diff --git a/src/Mindee.Cli/Program.cs b/src/Mindee.Cli/Program.cs index af0e071e..b92645cd 100644 --- a/src/Mindee.Cli/Program.cs +++ b/src/Mindee.Cli/Program.cs @@ -1,10 +1,8 @@ using System.CommandLine; -using System.CommandLine.Builder; -using System.CommandLine.Hosting; -using System.CommandLine.Parsing; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Mindee; using Mindee.Cli.Commands; -// ReSharper disable once RedundantUsingDirective using Mindee.Extensions.DependencyInjection; using PredictBankAccountDetailsCommand = Mindee.Cli.Commands.PredictCommand< Mindee.Product.Fr.BankAccountDetails.BankAccountDetailsV2, @@ -82,98 +80,125 @@ Mindee.Product.Receipt.ReceiptV5Document >; -var runner = BuildCommandLine() - .UseHost(_ => Host.CreateDefaultBuilder(args), builder => +// Setup dependency injection +var host = Host.CreateDefaultBuilder(args) + .ConfigureServices((_, services) => { - builder - .ConfigureServices((_, services) => - { - services.AddMindeeClient(); - services.AddMindeeClientV2(); - }) - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - .UseCommandHandler() - ; + services.AddMindeeClient(); + services.AddMindeeClientV2(); }) - .UseHelp() - .UseParseErrorReporting() - .CancelOnProcessTermination() - .UseEnvironmentVariableDirective() - .UseParseDirective() - .UseSuggestDirective() - .UseTypoCorrections() - .UseExceptionHandler() .Build(); -return await runner.InvokeAsync(args); +var root = BuildCommandLine(host.Services); -static CommandLineBuilder BuildCommandLine() +return await root.Parse(args).InvokeAsync(); + +static RootCommand BuildCommandLine(IServiceProvider services) { var root = new RootCommand(); - root.AddCommand(new PredictBarcodeReaderCommand(new CommandOptions( + var mindeeClient = services.GetRequiredService(); + + var barcodeReaderCmd = new PredictBarcodeReaderCommand(new CommandOptions( "barcode-reader", "Barcode Reader", - false, false, true, false))); - root.AddCommand(new PredictCropperCommand(new CommandOptions( + false, false, true, false)); + barcodeReaderCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(barcodeReaderCmd); + + var cropperCmd = new PredictCropperCommand(new CommandOptions( "cropper", "Cropper", - false, false, true, false))); - root.AddCommand(new PredictFinancialDocumentCommand(new CommandOptions( + false, false, true, false)); + cropperCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(cropperCmd); + + var financialDocumentCmd = new PredictFinancialDocumentCommand(new CommandOptions( "financial-document", "Financial Document", - true, false, true, true))); - root.AddCommand(new PredictBankAccountDetailsCommand(new CommandOptions( + true, false, true, true)); + financialDocumentCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(financialDocumentCmd); + + var bankAccountDetailsCmd = new PredictBankAccountDetailsCommand(new CommandOptions( "fr-bank-account-details", "FR Bank Account Details", - false, false, true, false))); - root.AddCommand(new PredictCarteGriseCommand(new CommandOptions( + false, false, true, false)); + bankAccountDetailsCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(bankAccountDetailsCmd); + + var carteGriseCmd = new PredictCarteGriseCommand(new CommandOptions( "fr-carte-grise", "FR Carte Grise", - false, false, true, false))); - root.AddCommand(new PredictHealthCardCommand(new CommandOptions( + false, false, true, false)); + carteGriseCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(carteGriseCmd); + + var healthCardCmd = new PredictHealthCardCommand(new CommandOptions( "fr-health-card", "FR Health Card", - false, false, false, true))); - root.AddCommand(new PredictIdCardCommand(new CommandOptions( + false, false, false, true)); + healthCardCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(healthCardCmd); + + var idCardCmd = new PredictIdCardCommand(new CommandOptions( "fr-carte-nationale-d-identite", "FR Carte Nationale d'Identité", - false, false, true, false))); - root.AddCommand(new PredictPayslipCommand(new CommandOptions( + false, false, true, false)); + idCardCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(idCardCmd); + + var payslipCmd = new PredictPayslipCommand(new CommandOptions( "fr-payslip", "FR Payslip", - false, false, false, true))); - root.AddCommand(new PredictInternationalIdCommand(new CommandOptions( + false, false, false, true)); + payslipCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(payslipCmd); + + var internationalIdCmd = new PredictInternationalIdCommand(new CommandOptions( "international-id", "International ID", - false, true, false, true))); - root.AddCommand(new PredictInvoiceCommand(new CommandOptions( + false, true, false, true)); + internationalIdCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(internationalIdCmd); + + var invoiceCmd = new PredictInvoiceCommand(new CommandOptions( "invoice", "Invoice", - true, false, true, true))); - root.AddCommand(new PredictInvoiceSplitterCommand(new CommandOptions( + true, false, true, true)); + invoiceCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(invoiceCmd); + + var invoiceSplitterCmd = new PredictInvoiceSplitterCommand(new CommandOptions( "invoice-splitter", "Invoice Splitter", - false, false, false, true))); - root.AddCommand(new PredictMultiReceiptsDetectorCommand(new CommandOptions( + false, false, false, true)); + invoiceSplitterCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(invoiceSplitterCmd); + + var multiReceiptsDetectorCmd = new PredictMultiReceiptsDetectorCommand(new CommandOptions( "multi-receipts-detector", "Multi Receipts Detector", - false, false, true, false))); - root.AddCommand(new PredictPassportCommand(new CommandOptions( + false, false, true, false)); + multiReceiptsDetectorCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(multiReceiptsDetectorCmd); + + var passportCmd = new PredictPassportCommand(new CommandOptions( "passport", "Passport", - false, false, true, false))); - root.AddCommand(new PredictReceiptCommand(new CommandOptions( + false, false, true, false)); + passportCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(passportCmd); + + var receiptCmd = new PredictReceiptCommand(new CommandOptions( "receipt", "Receipt", - true, false, true, true))); - root.AddCommand(new PredictBankCheckCommand(new CommandOptions( + true, false, true, true)); + receiptCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(receiptCmd); + + var bankCheckCmd = new PredictBankCheckCommand(new CommandOptions( "us-bank-check", "US Bank Check", - false, false, true, false))); + false, false, true, false)); + bankCheckCmd.ConfigureAction(mindeeClient); + root.Subcommands.Add(bankCheckCmd); + + var silentOption = new Option("--silent") + { + Description = "Disables diagnostics output" + }; + root.Options.Add(silentOption); - root.AddGlobalOption(new Option("--silent", "Disables diagnostics output")); - root.SetHandler(() => + root.SetAction(parseResult => { - root.InvokeAsync("--help"); + Console.WriteLine("Please specify a subcommand. Use --help for more information."); + return 1; }); - return new CommandLineBuilder(root); + return root; } diff --git a/src/Mindee/Image/ImageCompressor.cs b/src/Mindee/Image/ImageCompressor.cs index 561782fc..414c8cc1 100644 --- a/src/Mindee/Image/ImageCompressor.cs +++ b/src/Mindee/Image/ImageCompressor.cs @@ -19,8 +19,9 @@ public static byte[] CompressImage(SKBitmap original, int quality, int finalWidt { using var image = SKImage.FromBitmap(original); using var compressedBitmap = SKBitmap.FromImage(image); + var samplingOptions = new SKSamplingOptions(SKFilterMode.Linear, SKMipmapMode.None); using var finalImage = - compressedBitmap.Resize(new SKImageInfo(finalWidth, finalHeight), SKFilterQuality.Low); + compressedBitmap.Resize(new SKImageInfo(finalWidth, finalHeight), samplingOptions); return finalImage.Encode(SKEncodedImageFormat.Jpeg, quality).ToArray(); } diff --git a/src/Mindee/Mindee.csproj b/src/Mindee/Mindee.csproj index 75ca0ee0..61815641 100644 --- a/src/Mindee/Mindee.csproj +++ b/src/Mindee/Mindee.csproj @@ -4,30 +4,6 @@ net472;net48;net6.0;net7.0;net8.0;net9.0;net10.0 - - - - - - - - - - - - - - - - - - - - - - - - <_Parameter1>Mindee.UnitTests diff --git a/src/Mindee/Pdf/PdfUtils.cs b/src/Mindee/Pdf/PdfUtils.cs index 7cf3c2f3..c16b6805 100644 --- a/src/Mindee/Pdf/PdfUtils.cs +++ b/src/Mindee/Pdf/PdfUtils.cs @@ -93,8 +93,9 @@ public static SKBitmap GeneratePageBitmap(int imageQuality, IPageReader pageRead private static void WriteTextToCanvas(SKBitmap bitmap, Character character, SKCanvas canvas) { using var paint = new SKPaint(); + using var font = new SKFont(); var textColor = ImageUtils.InferTextColor(bitmap, character.Box); - paint.TextSize = (float)character.FontSize * (72f / 96f); + font.Size = (float)character.FontSize * (72f / 96f); paint.Color = textColor; var fontManager = SKFontManager.Default; @@ -105,14 +106,12 @@ private static void WriteTextToCanvas(SKBitmap bitmap, Character character, SKCa string.Equals(fontManager.MatchFamily(tmpFontName).FamilyName, tmpFontName, StringComparison.OrdinalIgnoreCase) ) ?? "Liberation Sans"; - paint.Typeface = SKTypeface.FromFamilyName(fontName); - - paint.TextAlign = SKTextAlign.Left; + font.Typeface = SKTypeface.FromFamilyName(fontName); var text = character.Char.ToString(); var lines = text.Split(["\r\n", "\n"], StringSplitOptions.None); - var lineHeight = paint.FontSpacing; + var lineHeight = font.Spacing; var boxCenterX = (character.Box.Left + character.Box.Right) / 2f; float boxBottom = character.Box.Bottom; @@ -124,8 +123,7 @@ private static void WriteTextToCanvas(SKBitmap bitmap, Character character, SKCa continue; } - var lineBounds = new SKRect(); - paint.MeasureText(line, ref lineBounds); + font.MeasureText(line, out var lineBounds); var x = boxCenterX - (lineBounds.Width / 2f); var y = boxBottom - ((lines.Length - i) * lineHeight); @@ -139,8 +137,8 @@ private static void WriteTextToCanvas(SKBitmap bitmap, Character character, SKCa } var charString = c.ToString(); - canvas.DrawText(charString, x, y, paint); - x += paint.MeasureText(charString); + canvas.DrawText(charString, x, y, font, paint); + x += font.MeasureText(charString); } } } diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index e54bbd3a..95f914d7 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -9,31 +9,19 @@ - - - - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - - - - - - - diff --git a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj index 938d8419..ba538a5d 100644 --- a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj +++ b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj @@ -10,10 +10,8 @@ - + - - runtime; build; native; contentfiles; analyzers; buildtransitive @@ -25,23 +23,6 @@ - - - - - - - - - - - - - - - - - From b74db846aa9458b608d6246be58d48b461ae0ec7 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 23 Jan 2026 13:14:27 +0100 Subject: [PATCH 03/65] fix tests --- src/Mindee/Pdf/PdfCompressor.cs | 7 ++++++- src/Mindee/Pdf/PdfUtils.cs | 6 +----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Mindee/Pdf/PdfCompressor.cs b/src/Mindee/Pdf/PdfCompressor.cs index 084352a5..ff9a69de 100644 --- a/src/Mindee/Pdf/PdfCompressor.cs +++ b/src/Mindee/Pdf/PdfCompressor.cs @@ -45,7 +45,12 @@ public static byte[] CompressPdf( using var docReader = DocLib.Instance.GetDocReader(pdfData, new PageDimensions(1)); var outputStream = new MemoryStream(); - using (var document = SKDocument.CreatePdf(outputStream)) + var metadata = new SKDocumentPdfMetadata + { + EncodingQuality = imageQuality + }; + + using (var document = SKDocument.CreatePdf(outputStream, metadata)) { ProcessPages(docReader, document, imageQuality, disableSourceText); } diff --git a/src/Mindee/Pdf/PdfUtils.cs b/src/Mindee/Pdf/PdfUtils.cs index c16b6805..1aff8156 100644 --- a/src/Mindee/Pdf/PdfUtils.cs +++ b/src/Mindee/Pdf/PdfUtils.cs @@ -60,12 +60,8 @@ public static SKBitmap GeneratePageBitmap(int imageQuality, IPageReader pageRead var compressedImage = ImageCompressor.CompressImage(initialBitmap, imageQuality, width, height); - var colorType = SKColorType.Argb4444; using var compressedBitmap = SKBitmap.Decode(compressedImage); - if (imageQuality > 85) - { - colorType = SKColorType.Rgb565; - } + const SKColorType colorType = SKColorType.Rgb565; using var surface = SKSurface.Create(new SKImageInfo(width, height, colorType)); From 6f162768a8e9b332add9d155104f7e7c7c1b9208 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 23 Jan 2026 17:21:00 +0100 Subject: [PATCH 04/65] fix deps? --- tests/Directory.Build.props | 12 ++++++++++++ .../Mindee.IntegrationTests.csproj | 2 +- tests/Mindee.UnitTests/Mindee.UnitTests.csproj | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 tests/Directory.Build.props diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props new file mode 100644 index 00000000..2b536aff --- /dev/null +++ b/tests/Directory.Build.props @@ -0,0 +1,12 @@ + + + + latest + false + + diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 95f914d7..d8cc9641 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -10,7 +10,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj index ba538a5d..51bd959d 100644 --- a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj +++ b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj @@ -10,7 +10,7 @@ - + From 5af617f7e72748e0d7e0b86911b46e23ce21524d Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:39:58 +0100 Subject: [PATCH 05/65] trim down un-needed dependencies --- Directory.Build.props | 10 ------ src/Mindee.Cli/Mindee.Cli.csproj | 13 +++---- tests/Directory.Build.props | 34 +++++++++++++++---- .../Mindee.IntegrationTests.csproj | 30 +--------------- .../Mindee.UnitTests/Mindee.UnitTests.csproj | 27 --------------- 5 files changed, 33 insertions(+), 81 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index de3d94c1..d0d91b08 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -46,7 +46,6 @@ - @@ -60,13 +59,4 @@ - - - - - - - - - diff --git a/src/Mindee.Cli/Mindee.Cli.csproj b/src/Mindee.Cli/Mindee.Cli.csproj index 8e1cd10a..6eb50d36 100644 --- a/src/Mindee.Cli/Mindee.Cli.csproj +++ b/src/Mindee.Cli/Mindee.Cli.csproj @@ -7,6 +7,10 @@ enable + + + + PreserveNewest @@ -28,18 +32,9 @@ - - - - - - - - - diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 2b536aff..17e0389e 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -1,12 +1,34 @@ - latest false + true + false + enable + $(NoWarn);1591 + false + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + Resources\async + + + diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index d8cc9641..abdee421 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -1,43 +1,15 @@ - net472;net48;net6.0;net7.0;net8.0;net9.0;net10.0 enable - enable - $(NoWarn);1591 - false + - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - - - - - - - PreserveNewest - - diff --git a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj index 51bd959d..a116fa0d 100644 --- a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj +++ b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj @@ -1,30 +1,11 @@ - net472;net48;net6.0;net7.0;net8.0;net9.0;net10.0 enable - enable - $(NoWarn);1591 - false - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - @@ -32,12 +13,4 @@ PreserveNewest - - - - Resources\async - - - - From da893e8759f642f96282f124799def13d2ffa24a Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:43:10 +0100 Subject: [PATCH 06/65] try removing additional csharp dependency (might break 472/48) --- Directory.Build.props | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d0d91b08..bc2cebab 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -54,9 +54,4 @@ - - - - - From b79a59019c8ca8a100a9df0b858abc9994a248f6 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:44:44 +0100 Subject: [PATCH 07/65] add 472 tests in integration suite just in case --- .github/workflows/_test-integrations.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index 5700da9b..3406458e 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -62,7 +62,8 @@ jobs: os: - "windows-2022" dotnet-version: - - "net482" + - "net472" + - "net48" - "net6.0" - "net10.0" runs-on: ${{ matrix.os }} From b9e40d35c6122bb1b8fb1ff74f33b52b2af3ec40 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:49:11 +0100 Subject: [PATCH 08/65] restore csharp dep for 472/48 --- Directory.Build.props | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index bc2cebab..d0d91b08 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -54,4 +54,9 @@ + + + + + From 1850325c3615124b98d56f6639c89aedab625425 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:57:25 +0100 Subject: [PATCH 09/65] fix broken paths for integration testing --- Directory.Build.props | 6 ++++++ tests/Mindee.UnitTests/Mindee.UnitTests.csproj | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d0d91b08..0a09d9cf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -42,6 +42,12 @@ false + + + PreserveNewest + + + diff --git a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj index a116fa0d..013ca91d 100644 --- a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj +++ b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj @@ -7,10 +7,4 @@ - - - - PreserveNewest - - From 7aa53058856f1d274c2f8de0a25c62ff6e21d976 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 12:08:24 +0100 Subject: [PATCH 10/65] fix paths --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0a09d9cf..d7d3da3e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -43,7 +43,7 @@ - + PreserveNewest From b8fede64f6c517efac93b7b7cb65b2036ce6a23f Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 12:16:47 +0100 Subject: [PATCH 11/65] refix paths --- Directory.Build.props | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d7d3da3e..b30ee885 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -43,9 +43,10 @@ - + PreserveNewest - + Resources\%(RecursiveDir)%(Filename)%(Extension) + From 7fb97a66d0b60e720d7213746cf9d07fc798018b Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 14:31:47 +0100 Subject: [PATCH 12/65] fix wrong location for test folder --- Directory.Build.props | 7 ------- tests/Directory.Build.props | 7 ++++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index b30ee885..d0d91b08 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -42,13 +42,6 @@ false - - - PreserveNewest - Resources\%(RecursiveDir)%(Filename)%(Extension) - - - diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 17e0389e..7990c55a 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -24,7 +24,12 @@ all - + + + PreserveNewest + Resources\%(RecursiveDir)%(Filename)%(Extension) + + Resources\async From 1bbd15801bfdff1d2fd3d8c2cdf476b4b7f4e142 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 14:49:18 +0100 Subject: [PATCH 13/65] fix net error in 472 --- tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index abdee421..9ccdacfe 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -12,4 +12,8 @@ + + + + From 0bbf058d6fcd988f5bdc4e3e16269a0f5c0fdeed Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 15:18:05 +0100 Subject: [PATCH 14/65] try with a pinned version? --- tests/Directory.Build.props | 2 +- tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 7990c55a..b24fc973 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -31,7 +31,7 @@ - + Resources\async diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 9ccdacfe..6957aea5 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -14,6 +14,6 @@ - + From e48d8a921cef6b90c531260054f2a1ff8253885b Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 15:18:31 +0100 Subject: [PATCH 15/65] fix syntax --- tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 6957aea5..568bf778 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -14,6 +14,9 @@ - + + + + From 55ad52650eb147b7ac22d138340689599b2956d4 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 16:24:09 +0100 Subject: [PATCH 16/65] try random suggestion...? --- .../DependencyInjection/ServiceCollectionsExtensions.cs | 7 ++++++- .../Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 7 ------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index 280e937c..36930eff 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -195,7 +195,12 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool UserAgent = BuildUserAgent(), Expect100Continue = false, CachePolicy = new CacheControlHeaderValue { NoCache = true, NoStore = true }, - ThrowOnAnyError = throwOnError + ThrowOnAnyError = throwOnError, + ConfigureMessageHandler = _ => new System.Net.Http.HttpClientHandler + { + UseProxy = false, + AutomaticDecompression = System.Net.DecompressionMethods.None + } }; return new MindeeV2RestClientWrapper(new RestClient(clientOptions)); }); diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 568bf778..abdee421 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -12,11 +12,4 @@ - - - - - - - From 7d9e5f1cdba249d0c29ea4acf2966375b263f921 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 17:07:31 +0100 Subject: [PATCH 17/65] try conditional restsharp just to see? --- Directory.Build.props | 7 ++++++- .../DependencyInjection/ServiceCollectionsExtensions.cs | 7 +------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d0d91b08..2abbac3e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -44,7 +44,6 @@ - @@ -55,8 +54,14 @@ + + + + + + diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index 36930eff..280e937c 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -195,12 +195,7 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool UserAgent = BuildUserAgent(), Expect100Continue = false, CachePolicy = new CacheControlHeaderValue { NoCache = true, NoStore = true }, - ThrowOnAnyError = throwOnError, - ConfigureMessageHandler = _ => new System.Net.Http.HttpClientHandler - { - UseProxy = false, - AutomaticDecompression = System.Net.DecompressionMethods.None - } + ThrowOnAnyError = throwOnError }; return new MindeeV2RestClientWrapper(new RestClient(clientOptions)); }); From 8bb0ae292a20e658aa126f1c3346e9a81798ac4b Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 17:37:43 +0100 Subject: [PATCH 18/65] bump broken restsharp --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2abbac3e..93ccc219 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -62,6 +62,6 @@ - + From fb17a4878b5a78f751e85093cc27f74ec84b6011 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 17:54:47 +0100 Subject: [PATCH 19/65] fix missing dependency --- Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Build.props b/Directory.Build.props index 93ccc219..d4dfb460 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -49,6 +49,7 @@ + From 7848a69008c1084c76cab2b1a71bb8920dfebab5 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 26 Jan 2026 18:04:41 +0100 Subject: [PATCH 20/65] try fix again...? --- Directory.Build.props | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index d4dfb460..7e542b9c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -65,4 +65,8 @@ + + + + From 8dbf7df01a4d9b1599922d4ddb4a7e708603a1c9 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 27 Jan 2026 10:27:55 +0100 Subject: [PATCH 21/65] fix dependencies --- .../Mindee.IntegrationTests.csproj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index abdee421..ee2165f8 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -9,6 +9,15 @@ + + + + + + + + + From 40920842f86de4e1347e06325403f3e121394e7e Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 27 Jan 2026 11:33:08 +0100 Subject: [PATCH 22/65] mess with dependencies again? --- Directory.Build.props | 4 ---- tests/Directory.Build.props | 5 +++++ tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 4 ---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7e542b9c..d4dfb460 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -65,8 +65,4 @@ - - - - diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index b24fc973..01bc0516 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -15,6 +15,7 @@ + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -36,4 +37,8 @@ + + + + diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index ee2165f8..d598a20f 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -14,10 +14,6 @@ - - - - From 47f5a5bfc94ab025a65ef33b4c47afc5a2e8a446 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 27 Jan 2026 14:53:00 +0100 Subject: [PATCH 23/65] downgrade deps for 472? --- Directory.Build.props | 2 ++ .../Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d4dfb460..2388d3ac 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -64,5 +64,7 @@ + + diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index d598a20f..c63ea68f 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -4,12 +4,6 @@ enable - - - - - - From c34b6a88e9d2bd112442d7c96360098331edf545 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 27 Jan 2026 15:26:53 +0100 Subject: [PATCH 24/65] try separate deps? --- Directory.Build.props | 20 ++++++++++++++------ src/Mindee.Cli/Mindee.Cli.csproj | 1 - 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2388d3ac..596f29a9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -44,12 +44,6 @@ - - - - - - @@ -58,12 +52,26 @@ + + + + + + + + + + + + + + diff --git a/src/Mindee.Cli/Mindee.Cli.csproj b/src/Mindee.Cli/Mindee.Cli.csproj index 6eb50d36..da4ac94b 100644 --- a/src/Mindee.Cli/Mindee.Cli.csproj +++ b/src/Mindee.Cli/Mindee.Cli.csproj @@ -32,7 +32,6 @@ - From 825efe0db0c44c02818c396b645ed92f57df6fa9 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 27 Jan 2026 15:58:16 +0100 Subject: [PATCH 25/65] try targetted downgrades? --- Directory.Build.props | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 596f29a9..0004c0a7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -66,13 +66,13 @@ - - - - - - - - + + + + + + + + From 71c2ddd98fdd54a72e93ce2206080473697bb71f Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 27 Jan 2026 17:55:16 +0100 Subject: [PATCH 26/65] fix broken path? --- tests/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 01bc0516..3fef21c0 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -10,7 +10,7 @@ - + From 01f27a560912c146e0acddbe6f65eebed9375926 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 27 Jan 2026 18:11:54 +0100 Subject: [PATCH 27/65] idk --- tests/Directory.Build.props | 3 --- tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 3 +++ tests/Mindee.UnitTests/Mindee.UnitTests.csproj | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 3fef21c0..0ff94d37 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -9,9 +9,6 @@ false - - - diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index c63ea68f..700c1d24 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -4,6 +4,9 @@ enable + + + diff --git a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj index 013ca91d..1c1850f8 100644 --- a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj +++ b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj @@ -4,6 +4,9 @@ enable + + + From 572abf042d85ab4f7b7520f0d757d9868b215849 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 27 Jan 2026 18:33:50 +0100 Subject: [PATCH 28/65] try yet again? --- Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0004c0a7..19ddf4a8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -65,8 +65,8 @@ - - + + From 4b3c00a5233c388f6c1f0181fb85eb4a747f037f Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 29 Jan 2026 18:09:28 +0100 Subject: [PATCH 29/65] try to import from main --- tests/Directory.Build.props | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 0ff94d37..4f596347 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -1,4 +1,6 @@ + latest false From 70cb289c8288031998908623a94204580a60815e Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 29 Jan 2026 18:15:13 +0100 Subject: [PATCH 30/65] fix duplicate import --- tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 700c1d24..5a35a72a 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -7,9 +7,6 @@ - - - From c6d575ac20aeba65a88b565bd761457118347550 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 3 Feb 2026 10:45:58 +0100 Subject: [PATCH 31/65] restart from earlier --- Directory.Build.props | 3 +-- .../DependencyInjection/ServiceCollectionsExtensions.cs | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 19ddf4a8..a3af501a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -47,11 +47,11 @@ + - @@ -65,7 +65,6 @@ - diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index 280e937c..3a57333c 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -122,7 +122,6 @@ private static void RegisterV1RestSharpClient(IServiceCollection services, bool var clientOptions = new RestClientOptions(settings.MindeeBaseUrl) { - FollowRedirects = false, Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), UserAgent = BuildUserAgent(), Expect100Continue = false, @@ -157,7 +156,6 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool var clientOptions = new RestClientOptions(settings.MindeeBaseUrl) { - FollowRedirects = false, Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), UserAgent = BuildUserAgent(), Expect100Continue = false, @@ -190,7 +188,6 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool var clientOptions = new RestClientOptions { BaseUrl = new Uri(settings.MindeeBaseUrl), - FollowRedirects = false, Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), UserAgent = BuildUserAgent(), Expect100Continue = false, From 1087c37eea545b17fdb36d602e2297e4b6348b3e Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 3 Feb 2026 10:57:20 +0100 Subject: [PATCH 32/65] fix version --- Directory.Build.props | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index a3af501a..a7513c1d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -48,6 +48,7 @@ + @@ -57,7 +58,6 @@ - @@ -65,7 +65,6 @@ - From 80f6e4036573368bcc43cc6fa2cf09c83cbbba06 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:56:32 +0100 Subject: [PATCH 33/65] restore follow redirects? --- .../DependencyInjection/ServiceCollectionsExtensions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index 3a57333c..6964496e 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -123,6 +123,7 @@ private static void RegisterV1RestSharpClient(IServiceCollection services, bool var clientOptions = new RestClientOptions(settings.MindeeBaseUrl) { Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), + FollowRedirects = false, UserAgent = BuildUserAgent(), Expect100Continue = false, CachePolicy = new CacheControlHeaderValue { NoCache = true, NoStore = true }, @@ -157,6 +158,7 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool var clientOptions = new RestClientOptions(settings.MindeeBaseUrl) { Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), + FollowRedirects = false, UserAgent = BuildUserAgent(), Expect100Continue = false, CachePolicy = new CacheControlHeaderValue { NoCache = true, NoStore = true }, @@ -188,6 +190,7 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool var clientOptions = new RestClientOptions { BaseUrl = new Uri(settings.MindeeBaseUrl), + FollowRedirects = false, Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), UserAgent = BuildUserAgent(), Expect100Continue = false, From d17e3fee08b0cd1e3e2e52098740c0db43eb25ff Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 4 Feb 2026 10:57:07 +0100 Subject: [PATCH 34/65] fix? --- .../ServiceCollectionsExtensions.cs | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index 6964496e..9f70574d 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -53,7 +53,11 @@ public static void AddMindeeApi( services.AddSingleton(serviceProvider => { var settings = serviceProvider.GetRequiredService>(); - var restClient = serviceProvider.GetRequiredService(); +#if NET6_0_OR_GREATER + var restClient = serviceProvider.GetRequiredKeyedService("MindeeV2RestClient"); +#else + var restClient = serviceProvider.GetRequiredService().Client; +#endif var logger = serviceProvider.GetService()?.CreateLogger(); return new MindeeApi(settings, restClient, logger); }); @@ -103,6 +107,10 @@ private static void RegisterV1RestSharpClient(IServiceCollection services, bool { services.AddSingleton(provider => { +#if !NET6_0_OR_GREATER + // FIX: Ensure legacy .NET Framework allows enough connections and uses modern TLS. + ConfigureLegacyNetworking(); +#endif var settings = provider.GetRequiredService>().Value; settings.MindeeBaseUrl = Environment.GetEnvironmentVariable("Mindee__BaseUrl"); if (string.IsNullOrEmpty(settings.MindeeBaseUrl)) @@ -167,9 +175,10 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool return new RestClient(clientOptions); }); #else - // For .NET Framework, register as a named singleton using a wrapper approach services.AddSingleton(provider => { + ConfigureLegacyNetworking(); + var settings = provider.GetRequiredService>().Value; settings.MindeeBaseUrl = Environment.GetEnvironmentVariable("MindeeV2__BaseUrl"); if (string.IsNullOrEmpty(settings.MindeeBaseUrl)) @@ -202,6 +211,22 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool #endif } +#if !NET6_0_OR_GREATER + + /// + /// Adjusts global ServicePointManager settings for .NET Framework to allow modern API usage. + /// + private static void ConfigureLegacyNetworking() + { + if (System.Net.ServicePointManager.DefaultConnectionLimit < 50) + { + System.Net.ServicePointManager.DefaultConnectionLimit = 50; + } + + System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12; + } +#endif + private static string BuildUserAgent() { string platform; From 1f0e469367fe39411ed4c467cba89be7bb859d29 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 4 Feb 2026 11:10:07 +0100 Subject: [PATCH 35/65] test dubious fix --- .../DependencyInjection/ServiceCollectionsExtensions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index 9f70574d..b9210eeb 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -210,20 +210,22 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool }); #endif } - #if !NET6_0_OR_GREATER - /// /// Adjusts global ServicePointManager settings for .NET Framework to allow modern API usage. /// private static void ConfigureLegacyNetworking() { +#pragma warning disable SYSLIB0014 + if (System.Net.ServicePointManager.DefaultConnectionLimit < 50) { System.Net.ServicePointManager.DefaultConnectionLimit = 50; } System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12; + +#pragma warning restore SYSLIB0014 } #endif From f1eab0e3077662400b48498a1285ad7b015621f9 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:51:34 +0100 Subject: [PATCH 36/65] fix slop --- .../DependencyInjection/ServiceCollectionsExtensions.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index b9210eeb..514818dd 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -53,11 +53,8 @@ public static void AddMindeeApi( services.AddSingleton(serviceProvider => { var settings = serviceProvider.GetRequiredService>(); -#if NET6_0_OR_GREATER - var restClient = serviceProvider.GetRequiredKeyedService("MindeeV2RestClient"); -#else - var restClient = serviceProvider.GetRequiredService().Client; -#endif + var restClient = serviceProvider.GetRequiredService(); + var logger = serviceProvider.GetService()?.CreateLogger(); return new MindeeApi(settings, restClient, logger); }); From 1ad58de84be5e5d7a12437c047d326bfb63ae044 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 6 Feb 2026 10:12:11 +0100 Subject: [PATCH 37/65] downgrade - 1 --- Directory.Build.props | 2 +- .../ServiceCollectionsExtensions.cs | 30 ++----------------- tests/Directory.Build.props | 2 +- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index a7513c1d..c9a9cde0 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -65,7 +65,7 @@ - + diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index 514818dd..280e937c 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -54,7 +54,6 @@ public static void AddMindeeApi( { var settings = serviceProvider.GetRequiredService>(); var restClient = serviceProvider.GetRequiredService(); - var logger = serviceProvider.GetService()?.CreateLogger(); return new MindeeApi(settings, restClient, logger); }); @@ -104,10 +103,6 @@ private static void RegisterV1RestSharpClient(IServiceCollection services, bool { services.AddSingleton(provider => { -#if !NET6_0_OR_GREATER - // FIX: Ensure legacy .NET Framework allows enough connections and uses modern TLS. - ConfigureLegacyNetworking(); -#endif var settings = provider.GetRequiredService>().Value; settings.MindeeBaseUrl = Environment.GetEnvironmentVariable("Mindee__BaseUrl"); if (string.IsNullOrEmpty(settings.MindeeBaseUrl)) @@ -127,8 +122,8 @@ private static void RegisterV1RestSharpClient(IServiceCollection services, bool var clientOptions = new RestClientOptions(settings.MindeeBaseUrl) { - Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), FollowRedirects = false, + Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), UserAgent = BuildUserAgent(), Expect100Continue = false, CachePolicy = new CacheControlHeaderValue { NoCache = true, NoStore = true }, @@ -162,8 +157,8 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool var clientOptions = new RestClientOptions(settings.MindeeBaseUrl) { - Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), FollowRedirects = false, + Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), UserAgent = BuildUserAgent(), Expect100Continue = false, CachePolicy = new CacheControlHeaderValue { NoCache = true, NoStore = true }, @@ -172,10 +167,9 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool return new RestClient(clientOptions); }); #else + // For .NET Framework, register as a named singleton using a wrapper approach services.AddSingleton(provider => { - ConfigureLegacyNetworking(); - var settings = provider.GetRequiredService>().Value; settings.MindeeBaseUrl = Environment.GetEnvironmentVariable("MindeeV2__BaseUrl"); if (string.IsNullOrEmpty(settings.MindeeBaseUrl)) @@ -207,24 +201,6 @@ private static void RegisterV2RestSharpClient(IServiceCollection services, bool }); #endif } -#if !NET6_0_OR_GREATER - /// - /// Adjusts global ServicePointManager settings for .NET Framework to allow modern API usage. - /// - private static void ConfigureLegacyNetworking() - { -#pragma warning disable SYSLIB0014 - - if (System.Net.ServicePointManager.DefaultConnectionLimit < 50) - { - System.Net.ServicePointManager.DefaultConnectionLimit = 50; - } - - System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12; - -#pragma warning restore SYSLIB0014 - } -#endif private static string BuildUserAgent() { diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 4f596347..25a0bf1d 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -19,7 +19,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 94ae9ad6e6057fd038eb142d81dae414803524bb Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 6 Feb 2026 10:38:44 +0100 Subject: [PATCH 38/65] re-mutualize dependencies --- Directory.Build.props | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index c9a9cde0..828bdc1c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -49,28 +49,21 @@ + + + + + + + - - - - - - - - - - - - - - From adf7416c7b8fa2c10f560fdb1c7c6b95f840433d Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 6 Feb 2026 10:39:58 +0100 Subject: [PATCH 39/65] downgrade - 2 --- Directory.Build.props | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 828bdc1c..4c9e2f2b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -47,8 +47,6 @@ - - @@ -60,10 +58,14 @@ + + + + From eaf1304b74d6515d80e3a521cebcd69fd6179192 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 6 Feb 2026 10:53:25 +0100 Subject: [PATCH 40/65] huh? --- Directory.Build.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 4c9e2f2b..63a03547 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -52,18 +52,19 @@ - + + From bf3e25da1bd5aa76e9e3b2a7f4ce6e5c5ec88215 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 6 Feb 2026 11:24:28 +0100 Subject: [PATCH 41/65] downgrade - 4 --- Directory.Build.props | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 63a03547..b9aa1d12 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -47,12 +47,6 @@ - - - - - - @@ -60,13 +54,24 @@ + + + + + - + + + + + + + From 1c11f692a9b3181d0fd9a5f3ce1cf2ca523c82ad Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 6 Feb 2026 11:38:35 +0100 Subject: [PATCH 42/65] downgrade xunit? --- Directory.Build.props | 2 +- tests/Directory.Build.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index b9aa1d12..4e72b9eb 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -66,7 +66,7 @@ - + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 25a0bf1d..b48d705e 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -13,7 +13,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From 0c2d29dc3e8d64e599324e1f268d82cd1773516c Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 6 Feb 2026 11:46:10 +0100 Subject: [PATCH 43/65] re-upgrade some stuff --- Directory.Build.props | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 4e72b9eb..af717a76 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -47,31 +47,25 @@ + + + + + + + - - - - - - - - - - - - - From a11b04368063b5a3d73d3ef3897f98cc635b55a3 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 6 Feb 2026 14:50:43 +0100 Subject: [PATCH 44/65] re-align dependencyinjection version --- Directory.Build.props | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index af717a76..f9c268c0 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -50,14 +50,15 @@ - - + + + @@ -66,6 +67,8 @@ - + + + From 36a37f4f12d691957bdd1b5d083c4cec7eb31aac Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Fri, 6 Feb 2026 15:57:42 +0100 Subject: [PATCH 45/65] remove unneeded dep --- Directory.Build.props | 1 - tests/Directory.Build.props | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index f9c268c0..e5a6d718 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -47,7 +47,6 @@ - diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index b48d705e..19a06390 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -13,8 +13,8 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 03932d0b9bca184c086fa96b05b9e04255fa2d0e Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 11:56:21 +0100 Subject: [PATCH 46/65] fix deps, again... --- Directory.Build.props | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index e5a6d718..dfd22237 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -47,15 +47,15 @@ - - - - + + + + @@ -65,9 +65,13 @@ + + + + + + + - - - From 69cd39eb16e3f6001748a9d391d06325b58eacbb Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:06:06 +0100 Subject: [PATCH 47/65] fix dependency injection version --- Directory.Build.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index dfd22237..998520aa 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -64,8 +64,9 @@ + - + From 633a69f46ef70b5a400bbcc86f62d76ae974334c Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:22:00 +0100 Subject: [PATCH 48/65] restore to EXACT pre-PR-deps --- Directory.Build.props | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 998520aa..a4f5b95e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -64,15 +64,14 @@ - + - + - From f54529dd65cd70e4c17c36daf357616ccd13995a Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:37:07 +0100 Subject: [PATCH 49/65] restore minimal deps --- Directory.Build.props | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index a4f5b95e..bbe91fab 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -64,14 +64,13 @@ - + + - - - - - - + + + + From 7df487fe597a73e895e9ac0d2f68f5f8fd1bbded Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 13:25:06 +0100 Subject: [PATCH 50/65] try downgrade restsharp? --- Directory.Build.props | 2 +- tests/Directory.Build.props | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index bbe91fab..f9466396 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -67,7 +67,7 @@ - + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 19a06390..77d31534 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -36,8 +36,4 @@ - - - - From 305aa37e3b30faaaaa16e7347c528faba7827e59 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 13:28:04 +0100 Subject: [PATCH 51/65] move stuff --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index f9466396..bbe91fab 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -67,7 +67,7 @@ - + From 644f6000c86abcdd69ebd9d7cd1fb84e9e34488f Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:00:42 +0100 Subject: [PATCH 52/65] fix unit tests deps too? --- Directory.Build.props | 10 ++++++++-- tests/Mindee.UnitTests/UnitTestBase.cs | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index bbe91fab..00ac7fbc 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -64,8 +64,14 @@ - - + + + + + + + + diff --git a/tests/Mindee.UnitTests/UnitTestBase.cs b/tests/Mindee.UnitTests/UnitTestBase.cs index fb6ddaa3..c5602f12 100644 --- a/tests/Mindee.UnitTests/UnitTestBase.cs +++ b/tests/Mindee.UnitTests/UnitTestBase.cs @@ -98,7 +98,7 @@ private static ServiceProvider InitServiceProviderV2(HttpStatusCode statusCode, options.RequestTimeoutSeconds = 120; }); - services.AddKeyedSingleton("MindeeV2RestClient", + services.AddSingleton( new RestClient(new RestClientOptions { BaseUrl = new Uri("https://api.mindee.net"), From 09a4698dd8b892a1c308a61d7dcbaee30ff54880 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:25:16 +0100 Subject: [PATCH 53/65] bump system.text.json --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 00ac7fbc..0e0eea71 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -64,7 +64,7 @@ - + From 6828e00ee77fe4da09215956cae7430ee73b8745 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 15:47:36 +0100 Subject: [PATCH 54/65] what --- Directory.Build.props | 9 ++++++--- tests/Directory.Build.props | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0e0eea71..324a3751 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -63,10 +63,9 @@ - - + + - @@ -79,4 +78,8 @@ + + + + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 77d31534..0730dbed 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -24,6 +24,11 @@ all + + + + + PreserveNewest From 81ecc295734b30093f4f6ce58b00a394f5f51ea8 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 16:30:16 +0100 Subject: [PATCH 55/65] shenanigans --- Directory.Build.props | 5 ++--- tests/Directory.Build.props | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 324a3751..cdf6059e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -71,12 +71,11 @@ - - - + + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 0730dbed..5125d360 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -13,7 +13,6 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive From e0c86c7e0b37d5d97eed63b782e1de5606bdf5e1 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 16:54:59 +0100 Subject: [PATCH 56/65] idk what I'm doing at this point --- src/Mindee/Mindee.csproj | 3 +++ tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 2 +- tests/Mindee.UnitTests/Mindee.UnitTests.csproj | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mindee/Mindee.csproj b/src/Mindee/Mindee.csproj index 61815641..44272c73 100644 --- a/src/Mindee/Mindee.csproj +++ b/src/Mindee/Mindee.csproj @@ -8,6 +8,9 @@ <_Parameter1>Mindee.UnitTests + + <_Parameter1>Mindee.IntegrationTests + diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 5a35a72a..23a778c8 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -7,7 +7,7 @@ - + diff --git a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj index 1c1850f8..d79f9b0e 100644 --- a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj +++ b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj @@ -7,6 +7,7 @@ + From da01bdd30219db5a3c69fdf935486adfb418b29d Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 11 Feb 2026 17:26:24 +0100 Subject: [PATCH 57/65] idk --- tests/Directory.Build.props | 5 +---- .../Mindee.IntegrationTests.csproj | 8 ++++++-- tests/Mindee.UnitTests/Mindee.UnitTests.csproj | 1 - 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 5125d360..25c2506d 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -14,6 +14,7 @@ + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -24,10 +25,6 @@ - - - - PreserveNewest diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 23a778c8..94de6d53 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -3,11 +3,15 @@ net472;net48;net6.0;net7.0;net8.0;net9.0;net10.0 enable - - + + + + + + diff --git a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj index d79f9b0e..1c1850f8 100644 --- a/tests/Mindee.UnitTests/Mindee.UnitTests.csproj +++ b/tests/Mindee.UnitTests/Mindee.UnitTests.csproj @@ -7,7 +7,6 @@ - From 47f9bca56ca4ea8f72afdff4c7b73b05840bc853 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 12 Feb 2026 10:20:49 +0100 Subject: [PATCH 58/65] switch ordering + prioritize integration --- .github/workflows/pull-request.yml | 11 +++++------ .../Mindee.IntegrationTests.csproj | 7 ++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 9234a8f0..3bda1835 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -29,16 +29,15 @@ jobs: actions: read security-events: write contents: read - test-units: - uses: ./.github/workflows/_test-units.yml - needs: - - static-analysis - - codeql +# test-units: +# uses: ./.github/workflows/_test-units.yml +# needs: +# - static-analysis +# - codeql # - qodana-code-quality secrets: inherit test-integrations: uses: ./.github/workflows/_test-integrations.yml - needs: test-units secrets: inherit test-code-samples: uses: ./.github/workflows/_test-code-samples.yml diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 94de6d53..89a01d50 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -3,9 +3,6 @@ net472;net48;net6.0;net7.0;net8.0;net9.0;net10.0 enable - - - @@ -15,4 +12,8 @@ + + + + From 6d3b0598bd25cdfd16ec2ccbce8f1dc8bd8f1957 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 12 Feb 2026 10:27:12 +0100 Subject: [PATCH 59/65] only run tests on .NET Framework --- .github/workflows/_test-integrations.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index 3406458e..78bb8dbd 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -64,8 +64,8 @@ jobs: dotnet-version: - "net472" - "net48" - - "net6.0" - - "net10.0" +# - "net6.0" +# - "net10.0" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 From 9b2de8ae04a59fffb091398373d95d68949ee40e Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 12 Feb 2026 10:44:24 +0100 Subject: [PATCH 60/65] add restclient wrapper for V1 on .NET framework --- .../ServiceCollectionsExtensions.cs | 52 ++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index 280e937c..f650c2f7 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -16,6 +16,19 @@ namespace Mindee.Extensions.DependencyInjection { #if !NET6_0_OR_GREATER + /// + /// Wrapper for V1 RestClient to work around lack of keyed services in .NET Framework + /// + internal sealed class MindeeV1RestClientWrapper + { + public RestClient Client { get; } + + public MindeeV1RestClientWrapper(RestClient client) + { + Client = client; + } + } + /// /// Wrapper for V2 RestClient to work around lack of keyed services in .NET Framework /// @@ -53,7 +66,11 @@ public static void AddMindeeApi( services.AddSingleton(serviceProvider => { var settings = serviceProvider.GetRequiredService>(); - var restClient = serviceProvider.GetRequiredService(); +#if NET6_0_OR_GREATER + var restClient = serviceProvider.GetRequiredService(); +#else + var restClient = serviceProvider.GetRequiredService().Client; +#endif var logger = serviceProvider.GetService()?.CreateLogger(); return new MindeeApi(settings, restClient, logger); }); @@ -101,6 +118,7 @@ public static void AddMindeeApiV2( private static void RegisterV1RestSharpClient(IServiceCollection services, bool throwOnError) { +#if NET6_0_OR_GREATER services.AddSingleton(provider => { var settings = provider.GetRequiredService>().Value; @@ -131,6 +149,38 @@ private static void RegisterV1RestSharpClient(IServiceCollection services, bool }; return new RestClient(clientOptions); }); +#else + services.AddSingleton(provider => + { + var settings = provider.GetRequiredService>().Value; + settings.MindeeBaseUrl = Environment.GetEnvironmentVariable("Mindee__BaseUrl"); + if (string.IsNullOrEmpty(settings.MindeeBaseUrl)) + { + settings.MindeeBaseUrl = "https://api.mindee.net"; + } + + if (settings.RequestTimeoutSeconds <= 0) + { + settings.RequestTimeoutSeconds = 120; + } + + if (string.IsNullOrEmpty(settings.ApiKey)) + { + settings.ApiKey = Environment.GetEnvironmentVariable("Mindee__ApiKey"); + } + + var clientOptions = new RestClientOptions(settings.MindeeBaseUrl) + { + FollowRedirects = false, + Timeout = TimeSpan.FromSeconds(settings.RequestTimeoutSeconds), + UserAgent = BuildUserAgent(), + Expect100Continue = false, + CachePolicy = new CacheControlHeaderValue { NoCache = true, NoStore = true }, + ThrowOnAnyError = throwOnError + }; + return new MindeeV1RestClientWrapper(new RestClient(clientOptions)); + }); +#endif } private static void RegisterV2RestSharpClient(IServiceCollection services, bool throwOnError) From aab781a39e5d12b50d9fe6e9ef3baf687d893fe8 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 12 Feb 2026 11:00:53 +0100 Subject: [PATCH 61/65] fix client instanciating --- .github/workflows/_test-integrations.yml | 78 +++++++++---------- .../ServiceCollectionsExtensions.cs | 24 +++++- 2 files changed, 61 insertions(+), 41 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index 78bb8dbd..5387fe10 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -13,45 +13,45 @@ env: MindeeV2__Failure__Webhook__Id: ${{ secrets.MINDEE_V2_SE_TESTS_FAILURE_WEBHOOK_ID }} jobs: - test-nix: - name: Integration Test on *NIX - timeout-minutes: 35 - strategy: - max-parallel: 6 - matrix: - os: - - "ubuntu-22.04" - # needs looking into - # - "macos-14" - dotnet-version: - - "net6.0" - - "net8.0" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Set up .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.0.x - 8.0.x - 10.0.x - - - name: Install dependencies - run: | - dotnet restore - - - name: Build - run: | - dotnet build -f ${{ matrix.dotnet-version }} - - - name: Test - run: | - dotnet test -f ${{ matrix.dotnet-version }} --verbosity normal "tests\Mindee.IntegrationTests" - +# test-nix: +# name: Integration Test on *NIX +# timeout-minutes: 35 +# strategy: +# max-parallel: 6 +# matrix: +# os: +# - "ubuntu-22.04" +# # needs looking into +# # - "macos-14" +# dotnet-version: +# - "net6.0" +# - "net8.0" +# runs-on: ${{ matrix.os }} +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# +# - name: Set up .NET +# uses: actions/setup-dotnet@v4 +# with: +# dotnet-version: | +# 6.0.x +# 8.0.x +# 10.0.x +# +# - name: Install dependencies +# run: | +# dotnet restore +# +# - name: Build +# run: | +# dotnet build -f ${{ matrix.dotnet-version }} +# +# - name: Test +# run: | +# dotnet test -f ${{ matrix.dotnet-version }} --verbosity normal "tests\Mindee.IntegrationTests" +# test-windows: name: Integration Test on Windows diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index f650c2f7..ac68864f 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -290,7 +290,17 @@ public static IServiceCollection AddMindeeClient( string sectionName = "Mindee") { services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(provider => + { + var settings = provider.GetRequiredService>(); +#if NET6_0_OR_GREATER + var restClient = provider.GetRequiredService(); +#else + var restClient = provider.GetRequiredService().Client; +#endif + var logger = provider.GetService()?.CreateLogger(); + return new MindeeApi(settings, restClient, logger); + }); services.AddOptions() .BindConfiguration(sectionName) .Validate(settings => !string.IsNullOrEmpty(settings.ApiKey), "The Mindee V1 API key is missing"); @@ -314,7 +324,17 @@ public static IServiceCollection AddMindeeClientV2( string sectionName = "MindeeV2") { services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(provider => + { + var settings = provider.GetRequiredService>(); +#if NET6_0_OR_GREATER + var restClient = provider.GetRequiredKeyedService("MindeeV2RestClient"); +#else + var restClient = provider.GetRequiredService().Client; +#endif + var logger = provider.GetService()?.CreateLogger(); + return new MindeeApiV2(settings, restClient, logger); + }); services.AddOptions() .BindConfiguration(sectionName) .Validate(settings => !string.IsNullOrEmpty(settings.ApiKey), "The Mindee V2 API key is missing"); From 934ae7381ca92f647894445e9d90b4d2688fbbf7 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 12 Feb 2026 11:25:28 +0100 Subject: [PATCH 62/65] implement dispose method for client wrappers --- .../ServiceCollectionsExtensions.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index ac68864f..4d2dfa05 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -19,7 +19,7 @@ namespace Mindee.Extensions.DependencyInjection /// /// Wrapper for V1 RestClient to work around lack of keyed services in .NET Framework /// - internal sealed class MindeeV1RestClientWrapper + internal sealed class MindeeV1RestClientWrapper: IDisposable { public RestClient Client { get; } @@ -27,12 +27,17 @@ public MindeeV1RestClientWrapper(RestClient client) { Client = client; } + + public void Dispose() + { + Client.Dispose(); + } } /// /// Wrapper for V2 RestClient to work around lack of keyed services in .NET Framework /// - internal sealed class MindeeV2RestClientWrapper + internal sealed class MindeeV2RestClientWrapper: IDisposable { public RestClient Client { get; } @@ -40,6 +45,11 @@ public MindeeV2RestClientWrapper(RestClient client) { Client = client; } + + public void Dispose() + { + Client.Dispose(); + } } #endif From 5025fe0417dd00e87a758b3bc3fe0da420e3fb6e Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 12 Feb 2026 11:35:02 +0100 Subject: [PATCH 63/65] fix lint & resore tests --- .github/workflows/_test-integrations.yml | 82 +++++++++---------- .github/workflows/pull-request.yml | 11 +-- .../ServiceCollectionsExtensions.cs | 4 +- 3 files changed, 49 insertions(+), 48 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index 5387fe10..3406458e 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -13,45 +13,45 @@ env: MindeeV2__Failure__Webhook__Id: ${{ secrets.MINDEE_V2_SE_TESTS_FAILURE_WEBHOOK_ID }} jobs: -# test-nix: -# name: Integration Test on *NIX -# timeout-minutes: 35 -# strategy: -# max-parallel: 6 -# matrix: -# os: -# - "ubuntu-22.04" -# # needs looking into -# # - "macos-14" -# dotnet-version: -# - "net6.0" -# - "net8.0" -# runs-on: ${{ matrix.os }} -# steps: -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# -# - name: Set up .NET -# uses: actions/setup-dotnet@v4 -# with: -# dotnet-version: | -# 6.0.x -# 8.0.x -# 10.0.x -# -# - name: Install dependencies -# run: | -# dotnet restore -# -# - name: Build -# run: | -# dotnet build -f ${{ matrix.dotnet-version }} -# -# - name: Test -# run: | -# dotnet test -f ${{ matrix.dotnet-version }} --verbosity normal "tests\Mindee.IntegrationTests" -# + test-nix: + name: Integration Test on *NIX + timeout-minutes: 35 + strategy: + max-parallel: 6 + matrix: + os: + - "ubuntu-22.04" + # needs looking into + # - "macos-14" + dotnet-version: + - "net6.0" + - "net8.0" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 8.0.x + 10.0.x + + - name: Install dependencies + run: | + dotnet restore + + - name: Build + run: | + dotnet build -f ${{ matrix.dotnet-version }} + + - name: Test + run: | + dotnet test -f ${{ matrix.dotnet-version }} --verbosity normal "tests\Mindee.IntegrationTests" + test-windows: name: Integration Test on Windows @@ -64,8 +64,8 @@ jobs: dotnet-version: - "net472" - "net48" -# - "net6.0" -# - "net10.0" + - "net6.0" + - "net10.0" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3bda1835..9234a8f0 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -29,15 +29,16 @@ jobs: actions: read security-events: write contents: read -# test-units: -# uses: ./.github/workflows/_test-units.yml -# needs: -# - static-analysis -# - codeql + test-units: + uses: ./.github/workflows/_test-units.yml + needs: + - static-analysis + - codeql # - qodana-code-quality secrets: inherit test-integrations: uses: ./.github/workflows/_test-integrations.yml + needs: test-units secrets: inherit test-code-samples: uses: ./.github/workflows/_test-code-samples.yml diff --git a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs index 4d2dfa05..9214b363 100644 --- a/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs +++ b/src/Mindee/Extensions/DependencyInjection/ServiceCollectionsExtensions.cs @@ -19,7 +19,7 @@ namespace Mindee.Extensions.DependencyInjection /// /// Wrapper for V1 RestClient to work around lack of keyed services in .NET Framework /// - internal sealed class MindeeV1RestClientWrapper: IDisposable + internal sealed class MindeeV1RestClientWrapper : IDisposable { public RestClient Client { get; } @@ -37,7 +37,7 @@ public void Dispose() /// /// Wrapper for V2 RestClient to work around lack of keyed services in .NET Framework /// - internal sealed class MindeeV2RestClientWrapper: IDisposable + internal sealed class MindeeV2RestClientWrapper : IDisposable { public RestClient Client { get; } From 6f66d92e7453ba2136bdde219725f9d5e2747a3f Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:10:07 +0100 Subject: [PATCH 64/65] fix deps for unit tests? --- tests/Directory.Build.props | 4 ++++ tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 25c2506d..800a05f8 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -24,6 +24,10 @@ all + + + + diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 89a01d50..31b6fab4 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -4,11 +4,6 @@ enable - - - - - From be3a67dec97f42316f7bec3e0276032b2ab3ffe1 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 12 Feb 2026 16:21:01 +0100 Subject: [PATCH 65/65] fix unit tests --- tests/Directory.Build.props | 4 --- .../Mindee.IntegrationTests.csproj | 4 +++ tests/Mindee.UnitTests/UnitTestBase.cs | 25 +++++++++++++------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 800a05f8..25c2506d 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -24,10 +24,6 @@ all - - - - diff --git a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj index 31b6fab4..037b40f1 100644 --- a/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj +++ b/tests/Mindee.IntegrationTests/Mindee.IntegrationTests.csproj @@ -8,6 +8,10 @@ + + + + diff --git a/tests/Mindee.UnitTests/UnitTestBase.cs b/tests/Mindee.UnitTests/UnitTestBase.cs index c5602f12..89661952 100644 --- a/tests/Mindee.UnitTests/UnitTestBase.cs +++ b/tests/Mindee.UnitTests/UnitTestBase.cs @@ -59,11 +59,16 @@ public static ServiceProvider InitServiceProviderV1(HttpStatusCode statusCode, s options.RequestTimeoutSeconds = 120; }); - services.AddSingleton(new RestClient(new RestClientOptions + var restClient = new RestClient(new RestClientOptions { BaseUrl = new Uri("https://api.mindee.net"), ConfigureMessageHandler = _ => mockHttpMessageHandler.Object - })); + }); +#if NET6_0_OR_GREATER + services.AddSingleton(restClient); +#else + services.AddSingleton(new MindeeV1RestClientWrapper(restClient)); +#endif return services.BuildServiceProvider(); } @@ -98,12 +103,16 @@ private static ServiceProvider InitServiceProviderV2(HttpStatusCode statusCode, options.RequestTimeoutSeconds = 120; }); - services.AddSingleton( - new RestClient(new RestClientOptions - { - BaseUrl = new Uri("https://api.mindee.net"), - ConfigureMessageHandler = _ => mockHttpMessageHandler.Object - })); + var restClient = new RestClient(new RestClientOptions + { + BaseUrl = new Uri("https://api.mindee.net"), + ConfigureMessageHandler = _ => mockHttpMessageHandler.Object + }); +#if NET6_0_OR_GREATER + services.AddKeyedSingleton("MindeeV2RestClient", restClient); +#else + services.AddSingleton(new MindeeV2RestClientWrapper(restClient)); +#endif return services.BuildServiceProvider(); }