I was finally able to reproduce the error. It happens only in release version, AnyCPU;
I am using this code:
VS redistributables are installed of both x86 and x64. Happens on Windows 10, x64, but several users have reported the same on 7 and 8.
I am using this code:
string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
var CachePath = Path.Combine(exepath, "Cache");
if (!Directory.Exists(CachePath)) Directory.CreateDirectory(CachePath);
MagickAnyCPU.CacheDirectory = CachePath;
var test = MagickNET.SupportedFormats.Any();
Created folder has write access. It is empty.System.BadImageFormatException: Could not load file or assembly 'Magick.NET.Wrapper-x86, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'Magick.NET.Wrapper-x86, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec'
at ImageMagick.MagickNET.<get_SupportedFormats>d__0.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
at OneCommander.UserControlFileProcessor.InitialCheck() in c:\Users\Milos\Documents\bitCommander\bitCommander\UserControlFileProcessor.xaml.cs:line 104
=== Pre-bind state information ===
LOG: DisplayName = Magick.NET.Wrapper-x86, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec
(Fully-specified)
LOG: Appbase = file:///C:/Users/Milos/Documents/bitCommander/bitCommander/bin/Release/
LOG: Initial PrivatePath = NULL
Calling assembly : Magick.NET-AnyCPU, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Milos\Documents\bitCommander\bitCommander\bin\Release\OneCommander.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Magick.NET.Wrapper-x86, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec
LOG: Attempting download of new URL file:///C:/Users/Milos/Documents/bitCommander/bitCommander/bin/Release/Magick.NET.Wrapper-x86.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Debug version runs fine on the same computer; VS redistributables are installed of both x86 and x64. Happens on Windows 10, x64, but several users have reported the same on 7 and 8.