-
-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Magick.NET 9.0.0 - The type initializer for 'NativeResourceLimits' threw an exception. #1121
Comments
It looks like your |
I'm having a problem very similar to this. Upgrading a Winforms .NET Framweork 4.8 app from Magick.NET-Q8-AnyCPU v8.6.1 to v9.0.0 gives me:
You're correct, the bin folder does not contain the native dll, and the problem goes away when the it is manually copied from 'packages\Magick.NET-Q8-AnyCPU.9.0.0\runtimes\win-x64\native' to the bin folder. The odd thing is, the native dll is not in my bin folder after reverting to v8.6.1, and it works OK. Removing it from 'packages\Magick.NET-Q8-AnyCPU.9.0.0\runtimes\win-x64\native' and rebuilding doesn't recreate the problem in v8.6.1, either. I see that the size of Magick.NET-Q8-AnyCPU.dll is more than 17MB in v8.6.1, but less than 700KB in v9.0.0, so I suspect that the native dll used to be embedded in the managed dll, but no longer is? |
That is correct. In the previous version I had to embed the dll inside the library to make this work. But it looks like the native library is not automatically copied to the bin folder with .NET Standard 2.0 when .NET framework is being targeted. I will need to figure out why that is happening first before I can check if I can add something to make this happen. What kind of |
I have packages.config in every project. I’ve attached one. I think my .csproj files are are old style, but I’m not sure. They’re attached, too. Let me know if you need anything else. |
For what concern me, the situation is similar to @davidei1955 one. |
Same issue with my projects (Test and Web) that target 4.7.2 framework. After upgrading to v9, Magick.Native-Q16-x64.dll is not found. However I temporary fixed the problem by copying Magick.Native-Q16-x64.dll to a folder in the system's environment paths. |
A patch for this has been added to the |
Is it possible to create a small project that demonstrates this issue and share it on GitHub? |
Of course, I have uploaded a sample repository with a C# console application demo in which you can reproduce the issue we are facing (https://github.com/MattiaCamponesco/Magick.NET_9.1.0_demo/invitations) |
Thanks for the repository. I think I found a proper fix for it now. Can you try it again with release |
I had the same problem too, updating from v8 to v9, getting the exception with same native dll not found. I've just updated to v9.1.1, it's ok now, works. |
Yes, I confirm, v9.1.1 works. Thanks! |
Description
Dear all,
I was testing the new release of Magick.Net and I found out an exception limitating the memory of the process.
Error:
The type initializer for 'NativeResourceLimits' threw an exception.
Stack Trace:
at ImageMagick.ResourceLimits.NativeResourceLimits.LimitMemory(Double percentage) at ImageMagick.ResourceLimits.LimitMemory(Percentage percentage) in /_/src/Magick.NET/ResourceLimits.cs:line 95 at Libraries.Managers.Graphics.ImageManager..ctor(Process process) at Libraries.Managers.Graphics.GraphicsManager.Elabora_SincronizzazioneGrafiche_GestisciGrafica(DataTosGraficheServices dataTosGraficheServices) at Libraries.Managers.Graphics.GraphicsManager.Elabora_SincronizzazioneGrafiche()
Inner Exception:
System.DllNotFoundException: Unable to load DLL 'Magick.Native-Q8-x64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at ImageMagick.Environment.NativeMethods.X64.Environment_Initialize() at ImageMagick.Environment.Initialize() in /_/src/Magick.NET/Helpers/Environment.cs:line 22 at ImageMagick.ResourceLimits.NativeResourceLimits..cctor() in /_/src/Magick.NET/Native/ResourceLimits.cs:line 137
Steps to Reproduce
Call the method
ResourceLimits.LimitMemory(percentage)
System Configuration
The text was updated successfully, but these errors were encountered: