I've recently upgrade my system to ASP.NET Core 2.1.0-preview2-30045
This libraries are using System.Memory 4.5.0-preview2-26202-05
After update I'm not able to load image any more:
using (var image = Image.Load<Rgba32>(pictureDataBytes, new PngDecoder()))
this is throwing exception:
System.MethodAccessException: Attempt by method 'SixLabors.ImageSharp.Formats.Png.Filters.SubFilter.Decode(System.Span`1<Byte>, Int32)' to access method 'System.Span`1<System.Byte>.DangerousGetPinnableReference()' failed.
at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.DecodePixelData[TPixel](Stream compressedStream, ImageFrame`1 image)
at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.Decode[TPixel](Stream stream)
at SixLabors.ImageSharp.Formats.Png.PngDecoder.Decode[TPixel](Configuration configuration, Stream stream)
at SixLabors.ImageSharp.Image.<>c__DisplayClass43_0`1.<Load>b__0(Stream s)
at SixLabors.ImageSharp.Image.WithSeekableStream[T](Stream stream, Func`2 action)
at SixLabors.ImageSharp.Image.Load[TPixel](Stream stream, IImageDecoder decoder)
at SixLabors.ImageSharp.Image.Load[TPixel](Byte[] data, IImageDecoder decoder)
use System.Memory 4.5.0-preview2-26202-05 and try to load PNG image.
@msmolka the 4.5 version of System.Memory used by .NET Core 2.1 is not yet available on NuGet, thus we are not able to support it in our beta ImageSharp package published on NuGet.
This means that we only support .NET Core <= 2.0 at the moment. I hope 2.1 reaches preview state soon, so we can add support for it.
Thanks, I understand
I have web core app, which is using this library. I need to add SignalR, which is on preview right now, which then breaks this lib.
Fighting with manual binding redirects and codeBase, a lot of manual work. Had to switch off automatic binding redirects.
Maybe it will finally work. Started looking promising.
Just a comment if somebody will need to work with version 2.1 and ImageSharp
Binding redirects are working in .NET Core (in unit tests as well).
This issue can be workaround by disabling
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
Then get latest 4.4.0 System.Memory from nuget
put it in some folder and specify all redirects manually and create entry for previous version:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<codeBase version="4.0.0.0" href="dlls\4.4.0\System.Memory.dll" />
<codeBase version="4.0.1.0" href="System.Memory.dll" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
Looks like we've got a green light to fix this. Here's what we need to do:
span.DangerousGetPinnableReference() -> MemoryMarshal.GetReference(span)netcoreapp2.1 target to the test project2.1The last one is not critical, but I'm pretty much into testing everything that's considered to be a feature.
@JimBobSquarePants should we add this to the beta-3 milestone?
@antonfirsov Yeah, let's add it, it should be a quick win.
According to gitter news a PR is actually being prepared for this :)
What's the current status on this? .NET core 2.1 is meanwhile in preview2-final and the release slowly gets onto the horizon. Just searched through the PRs and couldn't find the mentioned one.
The nightlies support preview 2 so you should be able to run with the latest there.
I think #577 closes this. 2.1 should work fine in nightlies.
appveyor test execution will be added with .NET Core 2.1 RC2
Most helpful comment
Just a comment if somebody will need to work with version 2.1 and ImageSharp
Binding redirects are working in .NET Core (in unit tests as well).
This issue can be workaround by disabling
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>Then get latest
4.4.0System.Memoryfrom nugetput it in some folder and specify all redirects manually and create entry for previous version: