question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: The type initializer for 'NativeMagickImageCollection' threw an exception.

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am using the latest version of Magick.NET
  • I have searched open and closed issues to ensure it has not already been reported

Description

With the last 2 versions of Magick.NET I am getting the error:

Error: The type initializer for 'NativeMagickImageCollection' threw an exception.

Steps to Reproduce

Working with an MagickImageCollection as such:

// create a collection of images in order to support multi-page.
using (MagickImageCollection pages = new MagickImageCollection())
{
...
}

This does not happen on release 7.10.2.

  • Magick.NET version: .7.11.1 and 7.11.0.
  • Environment (Operating system, version and so on): This has happened on Windows 10 Build 1809, and Windows 7.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dlemstracommented, Apr 12, 2019

This always happens with the AnyCPU version of Magick.NET. You can control the location of the folder with MagickAnyCPU.CacheDirectory. And you could aldo whitelist the dll, it is signed with a code signing certificate.

0reactions
Yoda-Mancommented, Mar 29, 2021

I am getting this error only when I deploy the project it works fine from the dev project in visual studio

Read more comments on GitHub >

github_iconTop Results From Across the Web

MagickNet type initializer throws exception
The error is "The type initializer for 'ImageMagick.MagickImage' threw an exception." it does not matter if i insert an image file path in...
Read more >
c# - Errors After Obfuscar Obfuscation
I've used Obfuscar on my C# application, but the obfuscated version throws an exception where the normal version doesn't. I'm trying to figure ......
Read more >
magick Issue Tracker Rss Feed
System.TypeInitializationException: The type initializer for 'X64' threw an exception. ---> System.UnauthorizedAccessException: Access to the path 'C:\Windows\ ...
Read more >
Error Experienced when Publishing - E-Learning Heroes
<Message>The type initializer for 'NativeMagickImageCollection' threw an exception.</Message> <StackTrace> at new ImageMagick.
Read more >
[Solved] The type initializer for '' threw an exception
TypeInitializationException ". This error is raised due to Static constructor . Actually in my case i am accessing some value from the App.config ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found