1

I have migrated my ImageSharp references to version 1.0.0-dev000692. Now I can't load an Image anymore. I'm getting the exception you can see down below.

Call:

byte[] data = GetImage();
var image = Image.Load(data);

The function is called in a ASP.Net Core (2.0) application

Exception:

Method not found: '!0 System.ReadOnlySpan`1.get_Item(Int32)'.

at SixLabors.ImageSharp.Formats.Bmp.BmpImageFormatDetector.IsSupportedFileFormat(ReadOnlySpan`1 header)
at SixLabors.ImageSharp.Formats.Bmp.BmpImageFormatDetector.DetectFormat(ReadOnlySpan`1 header)
at SixLabors.ImageSharp.Image.<>c__DisplayClass0_0.<InternalDetectFormat>b__0(IImageFormatDetector x)
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.TryGetLast[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
at SixLabors.ImageSharp.Image.InternalDetectFormat(Stream stream, Configuration config)
at SixLabors.ImageSharp.Image.Decode[TPixel](Stream stream, Configuration config)
at SixLabors.ImageSharp.Image.WithSeekableStream[T](Stream stream, Func`2 action)
at SixLabors.ImageSharp.Image.Load[TPixel](Configuration config, Stream stream, IImageFormat& format)
at SixLabors.ImageSharp.Image.Load[TPixel](Configuration config, Byte[] data)
at work4all.Server.Api.Core.Controllers.FileController.ResizeBenutzerBild(Byte[] data, Int32 maxHeight, Int32 maxWidth, String filename) in D:\DEV\VSTS-work4all\work4all Server\work4all.Server.Api.Core\work4all.Server.Api.Core\Controllers\FileController.cs:line 211
slxSlashi
  • 267
  • 1
  • 3
  • 11
  • To reproduce the problem, you cann add a reference to **Microsoft.AspNetCore.SignalR" in Version **1.0.0-preview1-28158** – slxSlashi Jan 24 '18 at 15:21

2 Answers2

0

This isn't an issue with ImageSharp, rather an issue with the current CoreClr preview.

https://github.com/dotnet/coreclr/pull/14727

You must be using a preview of .Net Core 2.1, reverting back to 2.0 will fix for now.

Update.

Since beta4 the solution will run on .NET Core 2.1

James South
  • 10,147
  • 4
  • 59
  • 115
0

I ran into this issue too. Have you tried updating to SixLabors.ImageSharp.Drawing beta 4? It might require a little refactor work on your image manipulation logic but it managed to fix my issue even though I too was running on Core 2.

Opflash
  • 496
  • 1
  • 6
  • 12