Using an ASP.NET Core 2.0.6 app, I'm getting a thumbnailphoto (bytes array) from our AD and using Image.Load(thumbnailPhoto) to load it in a variable. This produces the error:
"ClassName": "System.MissingMethodException",
"Message": "Method not found: 'System.Span`1<!!1> System.MemoryExtensions.NonPortableCast(System.Span`1<!!0>)'.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at SixLabors.ImageSharp.Memory.ArrayPoolMemoryManager.Buffer`1.get_Span()\r\n at SixLabors.ImageSharp.Image.<>c__DisplayClass0_0.<InternalDetectFormat>b__0(IImageFormatDetector x)\r\n at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()\r\n at System.Linq.Enumerable.TryGetLast[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)\r\n at SixLabors.ImageSharp.Image.InternalDetectFormat(Stream stream, Configuration config)\r\n at SixLabors.ImageSharp.Image.DiscoverDecoder(Stream stream, Configuration config, IImageFormat& format)\r\n at SixLabors.ImageSharp.Image.Decode[TPixel](Stream stream, Configuration config)\r\n at SixLabors.ImageSharp.Image.WithSeekableStream[T](Configuration config, Stream stream, Func`2 action)\r\n at SixLabors.ImageSharp.Image.Load[TPixel](Configuration config, Stream stream, IImageFormat& format)\r\n at SixLabors.ImageSharp.Image.Load[TPixel](Configuration config, Byte[] data)\r\n at SharePointApi.Controllers.AdController.CreateImageThumbnailWithImageSharp(Byte[] thumbnailPhoto, Int32 width, Int32 height) in F:\\dev\\SharePointApi\\SharePointApi\\Controllers\\AdController.cs:line 174\r\n at SharePointApi.Controllers.AdController.<GetUsersInAdGroup>d__2.MoveNext() in F:\\dev\\SharePointApi\\SharePointApi\\Controllers\\AdController.cs:line 103",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233069,
"Source": "SixLabors.ImageSharp",
"WatsonBuckets": null,
"MMClassName": null,
"MMMemberName": null,
"MMSignature": null
}
It is working however in a .NET Framework 4.5.2 app using the SixLabors.ImageSharp version 1.0.0-beta0002 and SixLabors.Core version 1.0.0-beta0004
byte[] thumbnailPhotousing (var image = Image.Load(thumbnailPhoto))Are you able to check that your bin contains the System.Memory 4.5.0-preview1-26216-02 library?
Does your project contain any references to the old System.Memory library (4.4.0-preview1-25305-02)?
@iamcarbon here are my dependencies of the project:

@nfdevil Well there's your problem.
The current System.Memory preview version we are depending on is the one on Nuget
System.Memory 4.5.0-preview1-26216-02
The version you have in your solution is from the Myget feed which must have breaking changes.
Indeed, I've reverted my System.DirectoryServices.AccountManagement to 4.5.0-preview1-26216-02 and reinstalled the ImageSharp nuget. It works now, thanks!
Great! I'll close this off now then. Enjoy!
@JimBobSquarePants I've got same exception on dotnet 2.1-preview2. Here's my .csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0-preview2-final" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0003" />
</ItemGroup>
</Project>
In generated *.deps.json:
"SixLabors.ImageSharp/1.0.0-beta0003": {
"dependencies": {
"SixLabors.Core": "1.0.0-beta0005",
"System.Buffers": "4.5.0-preview2-26406-04",
"System.Memory": "4.5.0-preview2-26406-04",
"System.Runtime.CompilerServices.Unsafe": "4.5.0-preview2-26406-04"
},
"compile": {
"lib/netstandard2.0/SixLabors.ImageSharp.dll": {}
}
}
@xakep139 beta3 targets the preview1 dependencies. There's breaking changes in preview2.
@iamcarbon submitted a PR updating to a couple of days ago so that is now in the nightlies.
What's the plan to move to preview2 ?
The nightlies already are
Well you are too fast for me, I found it and couldn't remove my comment in time :/
Haha. You caught me at a good time :smile:
Is there a milestone for when this will be supported via the main NuGet feed? Beta-0004?
Next 24 hours hopefully
Is it expected that this should persist with ASP.NET Core 2.1 RTM & ImageSharp.Web from the standard Nuget feed? The System.Memory is now listed is just 4.5.0. (Installing ImageSharp & Web from the MyGet feed fixed this)
Nuget ImageSharp.Web has not been updated yet and still targets the beta3 of ImageSharp. You probably had the old version of ImageSharp installed
I think MemoryExtensions.NonPortableCast has been replaced by MemoryMashal.Cast in .NET Core 2.1, see https://github.com/dotnet/coreclr/pull/16091/commits/93ec62347a4e97b920513296eefb27bdacbecfe9.
Yup, and if you look at our source you'll see we use MemoryMarshal.Cast throughout.
Hey guys, ever since upgrading to the now-released ASP.NET Core 2.1, I'm getting the abovementioned error whenever I try to upload an image to my website. I've seen several issues and a pull request referencing this and I apologize if I'm just too stupid or tired to understand, but what's the status of this issue now that 2.1 is released?
I'm currently writing a step-by-step tutorial on ASP.NET Core and we've chosen ImageSharp as the best way of processing images there currently is, but we needed to upgrade to 2.1 and the version on NuGet doesn't seem to like that ATM. If I understood it correctly, the nightly build on MyGet should already have this covered. Can we expect the fix to arrive on NuGet as well in the near future, or do you think it will take a longer time? (absolute majority of our readers are just hobbyists and juniors capable of only using NuGet) Thanks in advance.
You’re using beta4 yeah? We could push out another beta if necessary easily enough
Thanks for the swift reply. Yes, all of our installed NuGet packages are up to date (ImageSharp & Drawing beta 4, Web beta 3).
I personally don't need a new beta version asap for development, but I can't deliver the result if something's not working. I could probably get away with it if you could confirm that the NuGet version with a fix should be available during this June, though.
@martinpetrovaj how does your project's dependency graph look like? Which versions are actually pulled by nuget and copied to your bin?
System.Memory hasn't changed between RC1 and the official 1.0 (the referenced PR is already part of the RC1). Are you sure you don't have other packages pulling in pre-RC1 versions of that package?
Can you make sure you updated all the System.* references to the official 1.0 everywhere?
Sorry, but I can't generate the dependency graph with the VS version I'm using. I've checked the project's and solution's dependencies and packages and everything seems to be using .NET Core 2.1.0 SDK and System.Memory version should be 4.5. Don't know if it helps, all I could find about it in my project's files was this in the deps.json:
"System.Memory/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-P56/L4B9vhz0YFTC4qIXFgx+VgMhg3JhCm5/EASihTotyjwmBt2QEAQdmd2tNctYET/w0CRJzVH1cwxgbKGnDQ==",
"path": "system.memory/4.5.0",
"hashPath": "system.memory.4.5.0.nupkg.sha512"
}
NuGet also says that 4.5 is the only version installed and used. I use but a few 3rd party packages and none of them have dependencies on earlies version of either .NET or System.Memory.
I tried to find the ImageSharp packages files and I think that I'm indeed using beta 4.
I apologize if I haven't answered your question, I have no previous experience troubleshooting this kind of problems, you'll have to talk to me like to a 6yr old kid…
@martinpetrovaj I also feel quite stupid when debugging these package hell issues. The whole thing doesn't make sense to me, and I have no idea how to reproduce it.
Are you running on .NET Core 2.1 runtime?
Can you do us a favor and try pulling our newest MyGet packages? There is some (not too high :disappointed:) chance that it may make the issue go away. In that case we will release a new hotfix beta ASAP.
Yes, I'm running on .NET Core 2.1 runtime, the issue sprung up after upgrading to it. All my projects use Microsfot.NETCore.App 2.1.0 SDK, it's a Core MVC web app if it matters.
I have just downloaded and installed the MyGet packages - ImageSharp and ImageSharp.Drawing dev1425, ImageSharp.Web dev000087, I can confirm that everything is working now.
@martinpetrovaj great news, thanks!
@JimBobSquarePants @tocsoft we need to push a new beta through the whole stack.
I wish I knew what was causing this. All our current released stack should be targeting the RC.
I seem to be having the same MissingMethodException: Method not found: 'System.Span1` error when trying to use ImageSharp.Web. To correct this problem, I'm trying to use the pre-release version from MyGet, but i can't seem to find it. The feed I'm using is https://www.myget.org/F/imagesharp/api/v3/index.json, and while I see ImageSharp there, I don't see ImageSharp.Web.
@johnnyoshika see my comment above.
https://github.com/SixLabors/ImageSharp/issues/510#issuecomment-393911300
We haven't pushed the new ImageSharp.Web yet even on MyGet. There's an open PR I need to review tonight if I can.
I'm running into this issue too
__Error Message__
Method not found: 'System.Span
1<!!1> System.MemoryExtensions.NonPortableCast(System.Span1)'.
__*.csproj__
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Centare.Extensions" Version="1.0.16" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.1.0-preview2-final" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="1.0.0-beta0003" />
</ItemGroup>
</Project>
__Dependencies__

What are we supposed to do to fix this, please help?
You need this update ImageSharp to beta4 and your system references also.
Are you talking about to this one, the one on the top?

I'd prefer not to mess around with adding a myget feed, as I'm already pointing to pre-release. Any other alternatives?
ImageSharp beta4 is on Nuget. You should be able to update to that.
I'm not seeing it on nuget.org, here is what I see:

__Update__
I just realized that I'm referring to the ImageSharp.Web package, which would give me a transient package dependency on ImageSharp proper. I see what you're saying now. Out of curiosity, are there plans to publish a new ImageSharp.Web with the beta4 bits?
https://www.nuget.org/packages/SixLabors.ImageSharp/1.0.0-beta0004
ImageSharp not ImageSharp.Web
Out of curiosity, are there plans to publish a new ImageSharp.Web with the beta4 bits?
Got some work to do on it first but I’ll try tonight. But swamped of late.
Though we may hold out for the impending beta 5. This week sometime hopefully
No worries, thank you so much for all that you do. This is an amazing project that you should be proud of...I know I would be.
Thanks mate! I really appreciate that!
Thanks to whoever opened this up! found out someone else published image sharp under a different username. / non pre-release after correcting the dependency to the beta, it's working! :)
Oh no, again?! Can you point me to the Nuget package?
I wrongfully installed Veldrid.ImageSharp thinking it was the same one.
It was more human error here, but yeah I need to read descriptions properly

I'm using net core 2, gonna be using the beta in production;
Ah no, that package is great, it allows Veldrid to load gpu textures via ImageSharp. Just needs an update, I should PR.
That looks awesome, I've been looking for something like that for one of my other projects, outside of work!
I really like image sharp, good work btw, I can't believe these things are not part of the standard lib
We're using image sharp at work to upload pictures of sites (boiler rooms), then resize them so they fit on the front-end properly and to check filetype without relying upon the filetype from the client which would be bad practice.
I really appreciate that this library worked the first time that I implemented it, zero exceptions and a properly resized image, I didn't even have to care about the aspect ratio fitting, it just handled it for me.
If I could give this library 5* I would.
Its a cool, very like this
Any updates on this error? In Windows 10 and Windows Server 2008 R2 it beta0003 works. But for me this error occurs on Windows Server 2016.
I compiled the ImageSharp.Web (directly from master branch) and it worked without any errors on the same server. It's is possible to use the master branch as a nuget reference while the new beta version is not released?
I also tried to use ImageSharp.Web beta0003 with ImageSharp beta0005 (installed both as dependecies), but it results in a diferent error:
TypeLoadException: Could not load type 'SixLabors.ImageSharp.Processing.Transforms.ResizeOptions' from assembly 'SixLabors.ImageSharp
@labmorales the issue being subject of this thread is fixed. By making sure your project is using only the new official versions of System.Memory, there should be no type load errors related to System.Span<T>.
Based on your comment, it seems to me that you are facing a compatibility problem related to ImageSharp.Web. I suggest to join our gitter channel, I'm pretty sure someone will be able to help you.
@antonfirsov thanks for the reply. I read the comments again more carefully and installing the ImageSharp beta0004 worked. I was trying before with beta0005.
We don't have a released build for beta 5 yet. I'm waiting on some benchmark results.
@JimBobSquarepants to avoid further confusion:
The latest NuGet release of IS.Web is beta0003, which is incompatible with the current IS beta0005. This is the root cause of the issue @labmorales is experiencing. Is this correct?
@antonfirsov correct. When i used ImageSharp.Web beta0003 with ImageSharp beta0005 it resulted on TypeLoadException: Could not load type 'SixLabors.ImageSharp.Processing.Transforms.ResizeOptions'.
My experience is the same as @labmorales'. The only combination that works for me is:
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0004" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="1.0.0-beta0003" />
We don't have a released build for beta 5 yet. I'm waiting on some benchmark results.
I really don't want to have to repeat myself again.
@JimBobSquarePants My comment wasn't to ask you to repeat yourself. It was to inform the group that my problem is the same as labmorales', and to show anyone who stumbles upon here what csproj settings works for me.
Most helpful comment
I really appreciate that this library worked the first time that I implemented it, zero exceptions and a properly resized image, I didn't even have to care about the aspect ratio fitting, it just handled it for me.
If I could give this library 5* I would.