首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ImageSharp无法加载图像(MethodNotFound)

ImageSharp无法加载图像(MethodNotFound)
EN

Stack Overflow用户
提问于 2018-01-24 14:06:37
回答 2查看 2.1K关注 0票数 1

我已经将我的ImageSharp引用迁移到1.0.0-dev000692版本。现在我不能再加载图像了。我得到了你在下面可以看到的例外。

调用

代码语言:javascript
复制
byte[] data = GetImage();
var image = Image.Load(data);

在ASP.Net Core (2.0)应用程序中调用该函数

异常

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-02-05 00:14:57

这不是ImageSharp的问题,而是当前CoreClr预览的问题。

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

您必须使用.Net Core2.1的预览版,现在恢复到2.0将修复。

更新.

由于beta4将在.NET Core2.1上运行该解决方案

票数 0
EN

Stack Overflow用户

发布于 2018-07-20 21:15:42

我也碰到了这个问题。您试过更新到SixLabors.ImageSharp.Drawing beta 4吗?它可能需要在图像操作逻辑上做一些重构工作,但它成功地解决了我的问题,尽管我也在Core 2上运行。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48424418

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档