Copied to clipboard

Flag this post as spam?

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


  • Chris Hall 22 posts 94 karma points
    Feb 28, 2022 @ 17:55
    Chris Hall
    0

    Cannot access a disposed object - RazorBuildProvider_CodeGenerationStarted

    I am seeing this error, intermittently, running in IIS Express in VS2019 - on 8.17.2, which generates this stack trace in the logs.

    I've seen reference to a similar issue way back in v7. I've also seen references to 'Cannot access a disposed object' (where people have left static references to umbraco helper or similar request bound objects).

    Not sure if that is relevant here though?

    Is anyone able to offer any insight?

    The only reference to any of my code here is the _Layout.cshtml - but i've got a few stack traces of this which have occured over time, and the references to my code are not consistently the same.

    {"@t":"2022-02-28T10:23:25.1738446Z","@mt":"An unhandled exception occurred","@l":"Error","@x":"System.Web.HttpParseException (0x80004005): Cannot access a disposed object. ---> System.ObjectDisposedException: Cannot access a disposed object.\r\n at System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(TimeoutTracker timeout)\r\n at System.Threading.ReaderWriterLockSlim.TryEnterReadLock(TimeoutTracker timeout)\r\n at Umbraco.ModelsBuilder.Embedded.PureLiveModelFactory.RazorBuildProviderCodeGenerationStarted(Object sender, EventArgs e) in D:\a\1\s\src\Umbraco.ModelsBuilder.Embedded\PureLiveModelFactory.cs:line 185\r\n at System.Web.WebPages.Razor.RazorBuildProvider.OnCodeGenerationStarted(IAssemblyBuilder assemblyBuilder)\r\n at System.Web.WebPages.Razor.RazorBuildProvider.GenerateCodeCore(IAssemblyBuilder assemblyBuilder)\r\n at System.Web.WebPages.Razor.RazorBuildProvider.GenerateCode(AssemblyBuilder assemblyBuilder)\r\n at System.Web.Compilation.AssemblyBuilder.AddBuildProvider(BuildProvider buildProvider)\r\n at System.Web.Compilation.AssemblyBuilder.AddBuildProvider(BuildProvider buildProvider)\r\n at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()\r\n at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()\r\n at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)\r\n at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)\r\n at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)\r\n at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)\r\n at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath)\r\n at System.Web.Compilation.BuildManager.GetCompiledType(String virtualPath)\r\n at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.GetCompiledType(String virtualPath)\r\n at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)\r\n at Umbraco.Web.Mvc.ProfilingView.Render(ViewContext viewContext, TextWriter writer) in D:\a\1\s\src\Umbraco.Web\Mvc\ProfilingView.cs:line 25\r\n at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)\r\n at System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper htmlHelper, String partialViewName)\r\n at ASP.PageViewsLayoutcshtml.Execute() in C:\Workspace\redactedUmbraco\DEV\redactedMedia.Umbraco\redactedMedia.Umbraco\Views\Layout.cshtml:line 35\r\n at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()\r\n at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()\r\n at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)\r\n at System.Web.WebPages.WebPageBase.<>cDisplayClass400.

  • Chris Hall 22 posts 94 karma points
    Mar 01, 2022 @ 09:44
    Chris Hall
    0

    After looking at this, it seems to be happening at places where it's trying to use Html helper.

    Html.Partial Html.GetGridHtml Html.RenderPartial

    Calls to these are consistently the root of the trace. I would assume then, that HtmlHelper is the object that is disposed.

    Not sure what would cause this, specifically during Razor parsing?

Please Sign in or register to post replies

Write your reply to:

Draft