SixLabors has not updated ImageSharp.Web to work with ImageSharp 2.0 yet. The latest version of ImageSharp.Web is 1.0.5.
EPiServer.CMS.Core 12.4.2, however, made ImageSharp 2.0 a dependency. Which means that ImageSharp is currently broken.
Which means that we can no longer do this:
It barfs with the following exception, and to my knowledge there is no workaround.
System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<SixLabors.ImageSharp.Formats.IImageFormat> SixLabors.ImageSharp.Image.DetectFormatAsync(SixLabors.ImageSharp.Configuration, System.IO.Stream)'. at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.<>c__DisplayClass19_0.<<ProcessRequestAsync>b__0>d.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.<>c__DisplayClass19_0.<ProcessRequestAsync>b__0(String key) at SixLabors.ImageSharp.Web.Middleware.ConcurrentDictionaryExtensions.GetOrAddAsync[TKey,TValue](ConcurrentDictionary`2 dictionary, TKey key, Func`2 valueFactory) at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.ProcessRequestAsync(HttpContext context, IImageResolver sourceImageResolver, ImageContext imageContext, IDictionary`2 commands) at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
This is discussed at Vincent Baaij's GitHub repo here:
There are also a number of discussions here on World:
Opti CMS Team: Can we rollback/undo the SixLabors.ImageSharp >=2.0 requirement until the CMS is ready to update to .NET 6? (pretty please)
Thanks for raising this Drew. I just wanted to flag that this is also an issue for us and we are very keen to find a solution.
I will forward this to CMS Core team - thanks for bringing this into our attention
We're sorry for the inconvenience, but we can't always consider all third-party dependencies you might have. We're trying to be as considerate as possible and have as wide dependency ranges as possible. In this case it's probably best to wait and update until SixLabors.ImageSharp.Web 2.0 has been released. The release seems imminent https://github.com/SixLabors/ImageSharp.Web/discussions/223.
Not sure what this has to do with .NET6? CMS is cross-compiled for .NET5 and .NET6, some auxillary packages hasn't been cross-compiled yet, but you should still be able to run .NET6. You could run .NET6 before we cross-compiled as well, but you had to explicitly update a lot of packags to get it to work. Now that's not necessary.
Thanks for the direct reply Johan. You are right, I got that confused: SixLabors.ImageSharp is a dependency for EPiServer.CMS.Core, but SixLabors.ImageSharp.Web is not. 🤦♂️
I imagine ImageSharp.Web is widely used for dynamic image processing with Opti CMS. I'm not even sure what else is available, unless you're working with a 3P DAM that can do it. I'll keep an eye on that GitHub thread.
Thanks for the tip on .NET6, I didn't realize we were already into official support--
fyi, I just uploaded V2.0.0 of my Baaijte.Optimizely.ImageSharp.Web package. This (only) works with .NET 6, CMS 12.5.0+ ImageSharp 2+ and ImageSharp.Web 2+