Search code examples
c#imagesharpsystem.memory

C# Six Labors ImageSharp runtime error System.Memory 4.0.1.0 Visual Studio 2019


In a project loaded in Visual Studio 2019 where image manipulation is needed, the Six Labors ImageSharp library is used. But when trying to load an image, the runtime error pops up:

FileNotFoundException: Could not load file or assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

In the project where ImageSharp is used, a System.Memory reference is installed and the properties say it's 4.0.1.0. But when compiled and checking the details of the DLL it says 4.6.28619.1

I've tried to delete the reference and reinstall with NuGet but got the same version difference. The NuGet package also doesn't show the version 4.0.1.0 listed under the 'Previous versions' section.

Tried to reinstall difference available versions of System.Memory but that didn't work. Also searched the issues on the GitHub repo, but this was not mentioned.

Is ImageSharp linked to 4.0.1.0 and no matter what version you install, it will show 4.0.1.0?

How can I solve this so the runtime error doesn't show and I can use ImageSharp?

Update: Installing the nightly build 'solved' the problem. This one uses System.Memory >= 4.5.3


Solution

  • Install the latest 1.0.0-rc0001 release.

    When working on NET Framework there were sometimes binding redirect problems caused by net standard funkiness. We now reference a much higher version.