newly added property not found.

7 years ago

I have added new property name "range" in searchBoxModel. I start my application then no bug comes but  when i restart again then, following error comes.
[MissingMethodException: Method not found: 'System.String Nop.Web.Models.Catalog.SearchBoxModel.get_Range()'].

SearchBoxModel code
public string Name { get; set; }
public int Range { get; set; }

SeachBox.cshtml code
@Html.HiddenFor(model => model.Name)
@Html.HiddenFor(model => model.Range)

when i access only 'Name' in view then error never comes but whenever i try to access 'Range' in view then, error comes.
Version: nopCommerce 2.8

Please help...

Thanks in advanced.
7 years ago
Any answer to this problem? I'm having the same issue. I added a new property in HeaderLinksModel.cs first try viewing the page works fine but when I closed the browser and do it again without cleaning/building the entire projects the problem will show up.

I'm using nopCommerce 3.00
7 years ago
Any answer on this one? I still haven't find the solution to this problem. Even in the live server I'm having this problem. Thanks!
7 years ago
Bump... Still having the same issue. Tried different solution by providing CustomProperties with new Dictionary, first debug session it went through but the second time it didn't pass through in HeaderLinks() action method! I guess I'm having the same issue.
7 years ago

We have the Same Issue in NOP 3.0.
We have an New Property of type Dictionary and it works
after first deployment. After a while (we think cache will expire)
We receive also the Method not found exception.

Have you found any solutions.


7 years ago
If it works at first and then after a while it doesn't, check to make sure you don't have any Nop.Core/Data/Services DLLs in your Plugins folder.  If it's an old version then the AppPool will reboot eventually and it loads those instead of the correct ones.
7 years ago

Thnkas for your Feedback.
I doubled checked it.
We don't have any NOP... DLL's in other directories.

We are now trying to clear the assemlby cache
at the time te app pool reclycler runs.

I will post our experienses soon..

7 years ago
Hello We could find a Solution:

The reason seems to be ASP.Net and the way it loads assemblies from your application directory for the first time and after a recycle. On first start, the assemblies are loaded from your application's bin directory and after a recycle (or even an IIS restart) it loads the assemblies from the Temporary ASP.NET Files directory. And depending on the situation more or less assemblies are loaded.

Her our Workaround (Not Nice but Works)
We load a new DLL in PreInitialize this will reload the Assemblies after Recygling:

Add a PreInitialize Entry in AssembliInfo.cs

[assembly: PreApplicationStartMethod(typeof(Nop.Web.Initializer), "BreakCache")]

Add a new Class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
using System.Web;
using System.Web.Compilation;

namespace Nop.Web
    public static class Initializer
        public static void BreakCache()
            // start the assembly
            string tempFolder = System.Threading.Thread.GetDomain().BaseDirectory;
            var assemblyName = new AssemblyName { Name = "Cachebuster_" + DateTime.Now.ToString("yyyyMMddhhmmssfff") };
            var filename = assemblyName.Name + ".dll";
            var fullpath = tempFolder + @"\Plugins\" + filename;

            // create our builders
            var asmBuilder = Thread.GetDomain()
                  .DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave, tempFolder + @"\Plugins\");
            var fakeModule = asmBuilder
                  .DefineDynamicModule(assemblyName.Name, filename, true);
            var typeBuilder = fakeModule
                  .DefineType(string.Format("WhoYaGonnaCall{0}", DateTime.Now.ToString("fff")), TypeAttributes.Public);
            var fakeMethod = typeBuilder
                  .DefineMethod("Cachebusters", MethodAttributes.Public | MethodAttributes.Static);

            // emit a minimum amount of IL
            var methodIL = fakeMethod.GetILGenerator();

            // create the type and save the DLL

            var assembly = Assembly.LoadFile(fullpath);


Hope it helps for others that need a quick fix.


7 years ago
What we did in the live server not in my local IIS express is we set the recycling pool to 30 days to check if it's reverting back to the first old installation nop.web.dll, now the server is running fine but we still have to find a better solution for this one.
7 years ago
Please check if you have a circular dependency with your plugins and nop.web. I guess this solves our problem.