ImageResizer.dll

4 years ago
After upgrading to  3.80 and attaching the latest NUGet updates to the project the following  error is being thrown.



Server Error in '/' Application.

Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.

Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:



[TypeLoadException: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.]
   System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
   System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +145
   System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +158
   System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +91
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +438
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
   System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit) +64
   WebActivator.AssemblyExtensions.GetActivationAttributes(Assembly assembly) +127
   WebActivator.ActivationManager.RunActivationMethods() +224
   WebActivator.ActivationManager.RunPreStartMethods() +41
   WebActivator.ActivationManager.Run() +64

[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +613
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +141
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9946132
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

  


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1073.0



The upgrade worked until I updated the the NUGet modules. Has anybody worked through the problem.


                                 Thanks,
                                 Bob H
4 years ago
Having the same issue, anyone have a fix?

Thanks
4 years ago
I fixed it by doing this

I noticed the ImageResizer.dll and ImageResizer.Plugins.PrettyGifs.dll was referenced in Nop.Services. From what I can tell it is being used inside PictureService.cs.

I just referenced these two dlls in Nop.Web and this error went away. I do have Nuget package restore on, so I am not sure if nuget solved other projects references as well.

Also make sure the versions match between the two projects.

Hope this helps.
4 years ago
BobH123 wrote:
...attaching the latest NUGet updates to the project...

That's why we don't update these NuGet packages (ImageResizer). You should not do it. The latest versions of these two packages don't work for some reasons
4 years ago
I was just testing my installation of nopCommerce on my local ISSExpress before I sent the new release to my production server so I just deleted everything and started over.

Everything works just fine including update the NUGet packages  except the ImageResizer stuff.

It appears that the 2.x.x versions work but the 4.0.5 versions do not. I will trace the problem today and let everyone know.
3 years ago
Any solution for this error? I have the same. Using branch dev from github up to 10/12/2016
3 years ago
I noticed that i have this problem only when using the project with VS2015.

Maybe VS2015 is restoring the Nuget differently.
3 years ago
ludlamzgull wrote:
I noticed that i have this problem only when using the project with VS2015.

Maybe VS2015 is restoring the Nuget differently.


Found the problem, just delete from the bin directory the ImageResizer.dll