TypeLoadException at MagickImageCollection.AddImages with Mono on Ubuntu
See original GitHub issueHey,
I’m currently trying to convert pdf files using Magick.NET with Mono on Ubuntu 16.04. However, when executing this simple console application:
public static class Program
{
public static void Main()
{
using (var images = new MagickImageCollection())
{
images.Read("Snakeware.pdf");
for (var i = 1; i <= images.Count; i++)
{
images[i].Write($"Snakeware.Page.{i}.png");
}
}
}
}
I get the following exception:
/usr/bin/mono /home/pettfre/Repos/typeloadexception-magicknet/Magick.Net.Error/ConsoleApplication/bin/Debug/ConsoleApplication.exe
Could not load signature of ImageMagick.MagickImage:ToBitmapSource due to: Could not load file or assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. assembly:PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:<unknown type> member:<none>
Could not load signature of ImageMagick.IMagickImage:ToBitmapSource due to: Could not load file or assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. assembly:PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:<unknown type> member:<none>
Unhandled Exception:
System.TypeLoadException: Could not resolve the signature of a virtual method
at ImageMagick.MagickImageCollection.AddImages (System.IntPtr result, ImageMagick.MagickSettings settings) [0x00007] in <45292dcb447e4450bb12f45cb1a5f855>:0
at ImageMagick.MagickImageCollection.AddImages (System.String fileName, ImageMagick.MagickReadSettings readSettings, System.Boolean ping) [0x00034] in <45292dcb447e4450bb12f45cb1a5f855>:0
at ImageMagick.MagickImageCollection.Read (System.String fileName, ImageMagick.MagickReadSettings readSettings) [0x00006] in <45292dcb447e4450bb12f45cb1a5f855>:0
at ImageMagick.MagickImageCollection.Read (System.String fileName) [0x00000] in <45292dcb447e4450bb12f45cb1a5f855>:0
at ConsoleApplication.Program.Main () [0x00008] in <c949cae22a174c79a3837c6587272ad8>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not resolve the signature of a virtual method
at ImageMagick.MagickImageCollection.AddImages (System.IntPtr result, ImageMagick.MagickSettings settings) [0x00007] in <45292dcb447e4450bb12f45cb1a5f855>:0
at ImageMagick.MagickImageCollection.AddImages (System.String fileName, ImageMagick.MagickReadSettings readSettings, System.Boolean ping) [0x00034] in <45292dcb447e4450bb12f45cb1a5f855>:0
at ImageMagick.MagickImageCollection.Read (System.String fileName, ImageMagick.MagickReadSettings readSettings) [0x00006] in <45292dcb447e4450bb12f45cb1a5f855>:0
at ImageMagick.MagickImageCollection.Read (System.String fileName) [0x00000] in <45292dcb447e4450bb12f45cb1a5f855>:0
at ConsoleApplication.Program.Main () [0x00008] in <c949cae22a174c79a3837c6587272ad8>:0
I have renamed the Magick.NET-Q8-x64.Native.dll.so
to libMagick.NET-Q8-x64.Native.dll.so
and am clueless as to what I am supposed to do in order to solve this problem.
Is this a problem in the library or in my setup?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Mono TypeLoadException on XmlPreloadedResolver
I'm working on porting a Windows console app over to Linux using Mono. On my dev machine (Ubuntu), the app works like a...
Read more >Unhandled Exception: System.TypeLoadException when ...
When I run the app under linux - mono , the app starts no problem. However I seem to be having a problem...
Read more >System.TypeLoadException on Linux (Linux Mint 19) #2532
I experienced the same issue on Ubuntu 16.04. I had monoruntime package installed. For me, setting omnisharp.useGlobalMono to Never solved the ...
Read more >How to install Mono from source?
So I just ran sudo make install` after having compiled on a machine. When I run it ( mono bin/SparkleShare.exe ): A type...
Read more >Download - Stable | Mono
1 Add the Mono repository to your system. The package repository hosts the packages you need, add it with the following commands. Note:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, so what I ended up doing was a post build step:
This makes sure that the net40 version is replaced with netstandard13 version before (in my case) tests are executed.
Thanks a lot for your help!
Thanks for coming back and explaining how you solved this 👍