Prerequisites
ImageSharp.Web version
4.0.0
Other Six Labors packages and versions
ImageSharp 4.0.0
Environment (Operating system, version and so on)
Windows 11, Kestrel
.NET version
10.0
Description
Since 4.0.0, when running ImageSharp.Web locally or in the CI/CD pipelines the following exception is thrown intermittently. On our production system (Azure App Service, Windows) it is not thrown at all.
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HNM646UV6KOA", Request id "0HNM646UV6KOA:00000017": An unhandled exception was thrown by the application.
System.ArgumentException: An item with the same key has already been added. Key: autoorient
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Collections.ObjectModel.KeyedCollection`2.AddKey(TKey key, TItem item)
at System.Collections.ObjectModel.KeyedCollection`2.InsertItem(Int32 index, TItem item)
at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddlewareOptions.<>c.<.ctor>b__56_1(ImageCommandContext context)
at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
Based on the stacktrace, it seems like the following line is causing the issue:
|
context.Commands.Insert(0, new KeyValuePair<string, string?>(AutoOrientWebProcessor.AutoOrient, bool.TrueString)); |
I have no clue why, could it be a concurrency issue?
Steps to Reproduce
Unknown at this point.
Images
Not applicable.
Prerequisites
DEBUGandRELEASEmodeImageSharp.Web version
4.0.0
Other Six Labors packages and versions
ImageSharp 4.0.0
Environment (Operating system, version and so on)
Windows 11, Kestrel
.NET version
10.0
Description
Since 4.0.0, when running ImageSharp.Web locally or in the CI/CD pipelines the following exception is thrown intermittently. On our production system (Azure App Service, Windows) it is not thrown at all.
Based on the stacktrace, it seems like the following line is causing the issue:
ImageSharp.Web/src/ImageSharp.Web/Middleware/ImageSharpMiddlewareOptions.cs
Line 43 in 592083f
I have no clue why, could it be a concurrency issue?
Steps to Reproduce
Unknown at this point.
Images
Not applicable.