Search code examples
sitecoreglass-mapper

GlassMapper - Boolean method not found HasValue


just installed glass mapper on a new Sitecore 8.1 solution and as soon as I loaded up the site I keep getting the following error - more details in screenshot.

Any thoughts?

Method not found: 'Boolean Glass.Mapper.ExtensionMethods.HasValue(System.String)'.

enter image description here


Solution

  • I guess you refferenced a wrong Glass.Mapper.dll from a old version of GlassMapper

    Can you check if you have this method

      /// <summary>
    /// Indicates whether the specified string has a value, i.e. Not null or empty
    /// 
    /// </summary>
    public static bool HasValue(this string target)
    {
      return !ExtensionMethods.IsNullOrEmpty(target);
    }
    

    inside class Glass.Mapper.ExtensionMethods

    I checked on GlassMapper vers 4.0.5