Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Yury Primakov 3 posts 23 karma points
    Jan 30, 2012 @ 22:20
    Yury Primakov
    0

    The type initializer for 'Examine.ExamineManager' threw an exception

    Hello,

    I've had an application built using Umbraco in production for about a month now without problems, but today, a mysterious exception error is being thrown by most of my Razor Script macros. The error is:

    Error loading Razor Script AnnouncementSummary.cshtml
    The type initializer for 'Examine.ExamineManager' threw an exception.

     

    And the details of the exception error are:

    Exception

    System.TypeInitializationException: The type initializer for 'Examine.ExamineManager' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Method not found: 'Void Examine.Providers.BaseIndexProvider.set_SupportUnpublishedContent(Boolean)'. (C:\inetpub\wwwroot\DCASConnect\DCASConnect\config\ExamineSettings.config line 12) ---> System.MissingMethodException: Method not found: 'Void Examine.Providers.BaseIndexProvider.set_SupportUnpublishedContent(Boolean)'. at UmbracoExamine.UmbracoContentIndexer.Initialize(String name, NameValueCollection config) at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) --- End of inner exception stack trace --- at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) at System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) at Examine.ExamineManager.LoadProviders() at Examine.ExamineManager..cctor() --- End of inner exception stack trace --- at umbraco.MacroEngines.ExamineBackedMedia.GetUmbracoMedia(Int32 id) at umbraco.MacroEngines.DynamicNode.Media(String propertyAlias) at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1) at ASP._Page_macroScripts_AnnouncementSummary_cshtml.Execute() in c:\inetpub\wwwroot\DCASConnect\DCASConnect\macroScripts\AnnouncementSummary.cshtml:line 13 

    Inner Exception

    Method not found: 'Void Examine.Providers.BaseIndexProvider.set_SupportUnpublishedContent(Boolean)'. (C:\inetpub\wwwroot\DCASConnect\DCASConnect\config\ExamineSettings.config line 12)


    This error is only happening on the production environment and I've been doing a lot of digging around the net without any solutions that work. I've tried getting the latest version of Examine and also tried changing the App Pool credentials to Network Service and granting it full access to c:\Windows\Temp. Both suggestions did not work.

    Here is one of my Razor Scripts that's generating the error:

    @{ var numberOfItems = 10; }
        @foreach (var item in @Model.Descendants("umbAnnouncementPage").Where("Visible").OrderBy("CreateDate desc").Take(numberOfItems))
        {  
          var imageUrl = "";
          var link = @item.Url;
          string text = @item.shortDescription;
          if (@item.HasValue("articleImage"))
          {  
            item.Media("articleImage"); @*** This is where it fails ***@
                    imageUrl = "/usercontrols/ImageGen.ashx?image=" + @item.Media("articleImage").UmbracoFile + "&width=120&crop=resize&pad=false&bgcolor=f2f2f2";
          }
          else
          {
            imageUrl = "/usercontrols/ImageGen.ashx?image=/media/3115/defaultannouncement.jpg&&width=120&&height=80&&constrain=true&&crop=resize";
          }
          if (@item.HasValue("url"))
          {
            link = @item.url;
          }
          var lineOfService = "";
          foreach (var line in @item.Ancestors("umbLineOfService")) {  lineOfService = line.lineOfServiceName; }
            <div class="clearboth">
              <h4 class="announcement underline-dotted"><a href="@link">@item.Title</a></h4>          
              <a class="summaryImageLeft announcementThumbnail" href="@link"><img alt="" src="@imageUrl" alt="@item.Title"/></a>
                        <div class="smaller-text summaryText">
                    @Library.Truncate(@text, 200)
              </div>
                        <div class="clearboth overline-dotted">
                            <a class="small-text floatright" href="@link">Read more...</a>
                            <span class="small-text">@lineOfService</span></div>
            </div>
            <br />
    }

    I highlighted above where the debugger throws the exception (on the call to Media()).

    There's a lot of pressure on me to fix this error, so any assistance would be appreciated. Thanks in advance.

  • Lennart Stoop 304 posts 842 karma points
    Jan 31, 2012 @ 00:35
    Lennart Stoop
    0

    Hi Yury,

    I'm not exactly sure why the Examine index provider would be throwing that error (although I would think its either a version issue, or a security/IIS issue).

    As for a quick fix, I would try a different approach in fetching the media file (instead of the razor DynamicMedia object you are using now)

    media = umbraco.library.GetMedia(id, false)
    

    This won't fix the problem with Examine, but might buy you more time to figure out the issue.

     

    Grtz

    L

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Jan 31, 2012 @ 09:44
    Dan Diplo
    0

    Sometimes deleting all your indexes (usually found in App_Data/Temp/ExamineIndexes) solves this, especially when moving between different versions of Examine. You can delete the entire contents of that folder, and then publish a page to get it indexing again. Darren Ferguson's Examine Dashboard is also a handy tool for debugging/re-indexing -  http://our.umbraco.org/projects/developer-tools/examine-dashboard

  • Yury Primakov 3 posts 23 karma points
    Jan 31, 2012 @ 23:46
    Yury Primakov
    0

    Lennart,

    I tried using your suggestion and I get the following value for media: "MS.Internal.Xml.XPath.XPathSelectionIterator"

    Dan,

    I tried deleting the Temp Examine Index files but even after I published a page, the Temp files were not recreated. I even tried recycling and restarting the App Pool. How can I get them to regenerate again?

    Also, I tried installing the examine dashboard module, hoping it would shed some light, but I get the following error opening opening it in Umbraco:

    Could not load control: '/usercontrols/IndexStatus.ascx'. 
    Error message: System.Web.HttpCompileException (0x80004005): c:\inetpub\DCAS Connect Test\usercontrols\IndexStatus.ascx(352): error CS1061: 'Examine.Providers.BaseIndexProvider' does not contain a definition for 'SupportUnpublishedContent' and no extension method 'SupportUnpublishedContent' accepting a first argument of type 'Examine.Providers.BaseIndexProvider' could be found (are you missing a using directive or an assembly reference?) at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at umbraco.cms.presentation.dashboard.OnInit(EventArgs e)

    Eventhough, I checked and the file is in the /usercontrols/ directory.

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Feb 01, 2012 @ 13:20
    Dan Diplo
    0

    If the indexes aren't rebuilding then that indicates a more fundamental problem. Also the fact that the Examine Dashboard module doesn't run either indicates something isn't right.

    I would check the umbracoLog table and look for any exceptions that are being raised by Examine. That may give you a clue as to what is happening. 

    You could also try upgrading to the latest version of Examine which is at http://examine.codeplex.com/  Again, you usually need to delete indexes and restart app pool and publish to get it running again.

     

     

  • Yury Primakov 3 posts 23 karma points
    Feb 01, 2012 @ 21:09
    Yury Primakov
    0

    The issue has been resolved apparently. I agree that something wasn't right, so I scheduled the server to be rebooted during off peak hours (policy prevents us from rebooting during peak work hours). Turns out that did the trick.

    According to the server logs, there was an unexpected crash over the weekend that started this whole mess. I guess something got corrupted/disabled during the crash.

    Thanks for your help.

  • Adam Prendergast 33 posts 77 karma points MVP c-trib
    Feb 16, 2012 @ 12:12
    Adam Prendergast
    0

    Just had this issue on v 4.7.1.

    As Dan advised deleting App_Data/Temp/ExamineIndexes and  App_Data/Temp/Razor fixed the issue.

Please Sign in or register to post replies

Write your reply to:

Draft