Giter Site home page Giter Site logo

skjelbek / block-breadcrumbs Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 61.66 MB

EPiServer add-on with the purpose of giving editors a better overview and navigation experience when editing blocks.

License: MIT License

C# 87.75% JavaScript 2.72% CSS 9.27% ASP 0.06% HTML 0.22%

block-breadcrumbs's People

Contributors

skjelbek avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

prokom-no

block-breadcrumbs's Issues

Error when not published on a page

Is it just me or is it by design? when creating without publishing, or published but not published on a page. It cracks?

NOWORK:
@{Html.RenderBlockBreadcrumbs(Model.PreviewContent);}

WORKS:
@{
try {
Html.RenderBlockBreadcrumbs(Model.PreviewContent);
} catch { }
}

[NullReferenceException: Objektreferensen har inte angetts till en instans av ett objekt.] EPiServer.Core.Internal.NullContentVersionRepository.CreateContentVersion(IContent content) +414 EPiServer.Core.Internal.NullContentVersionRepository.List(ContentReference contentLink, Boolean filterPublished) +226 EPiServer.Core.Internal.NullContentVersionRepository.List(VersionFilter filter, Int32 startIndex, Int32 maxRows, Int32& totalCount) +136 EPiServer.Core.IContentVersionRepositoryExtensions.List(IContentVersionRepository contentVersionRepository, ContentReference contentLink) +101 BlockBreadcrumbs.ContentExtensions.LastVersion(IContent content) +82 System.Linq.WhereSelectEnumerableIterator2.MoveNext() +237
System.Linq.WhereSelectEnumerableIterator2.MoveNext() +280 BlockBreadcrumbs.ContentExtensions.CheckUnpublished(IContent content, IContentRepository repo) +855 BlockBreadcrumbs.ContentExtensions.GetReferenceTree(IContent content, IContentRepository repo, Int32& totalNumberOfReferences) +78 **BlockBreadcrumbs.BreadcrumbHelper.RenderBlockBreadcrumbs(HtmlHelper htmlHelper, IContent currentBlock) +168** ASP._Page_Views_Preview_Index_cshtml.Execute() in C:\webb\x.se\dev1\x.mvc\Views\Preview\Index.cshtml:8 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +251 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +147 System.Web.WebPages.StartPage.ExecutePageHierarchy() +85 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +106 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +374 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +87
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +81
System.Web.Mvc.Async.<>c__DisplayClass3_1.b__1(IAsyncResult asyncResult) +188
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +648 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +131

EPiServer 10 Compatibility for IContentVersionRepository

Hi, I suggest you change the code in BlockBreadcrums.ContentExtensions since it does not compile any more when using the new version of EPiServer.

In the breaking changes for Episerver 10, this is writen:
CMS-3153 - IContentVersionRepository List methods have been consolidated into one. PageVersion is obsoleted.

The code is not backward compatible.

I have made a pull request.

Old version of code:

   private static ContentVersion LastVersion(this IContent content)
   {
       var versionRep = ServiceLocator.Current.GetInstance<IContentVersionRepository>();
       var lastVersion = versionRep.List(content.ContentLink).LastOrDefault();
       return lastVersion;
   }

My suggested new version:

   private static ContentVersion LastVersion(this IContent content)
   {
       //Changed in EPi 10: CMS-3153 - IContentVersionRepository List methods have been consolidated into one. PageVersion is obsoleted.
       //new signature: IEnumerable<ContentVersion> List(VersionFilter filter, int startIndex, int maxRows, out int totalCount);
       var versionsAvailable = 0;
       var versionRep = ServiceLocator.Current.GetInstance<IContentVersionRepository>();
       var lastVersion = versionRep.List(
           new VersionFilter()
           {
               Statuses = new List<VersionStatus> { VersionStatus.Published },
               ContentLink = content.ContentLink
           }, 0, 20, out versionsAvailable).LastOrDefault();
       return lastVersion;
   }

Timeouts / exceptions on unpublished blocks

We're using BlockBreadcrumbs 1.3.0 on an Episerver 10 site. It's working fine most of the time, but we've run into a problem with some unpublished blocks.

When creating a brand new block within the Block / Media tree, sometimes the Preview window hangs and times out. Occasionally an Episerver exception is thrown. It's not a consistent problem, so I'm struggling to come up with a reliable replication case.

However, I've done some debugging and found that when it does happen, the following statement, on line 52 of ContentExtensions.cs, inside the CheckUnpublished() method seems to be the cuplrit:

var allPending =
repo.GetAll(ContentReference.RootPage)
.Select(p => p.LastVersion())
.Where(version => !IsPublished(version))
.Select(v => repo.Get(v.ContentLink));

If I step through the code on a block which is causing problems, this statement will hang indefinitely.

If I comment out the entire CheckUnpublished() method call, the hanging and slow-downs seem to go away entirely.

We managed to capture this exception, which seems related:

Detailed error information (authorized by permissions to functions)
Url https://bp-cms.ageuk.org.uk:443/EPiServer/CMS/Content/globalassets/test-bp,,97618/?epieditmode=True
Referer https://bp-cms.ageuk.org.uk/EPiServer/CMS/
Exception details: InvalidOperationException: Unknown object of type System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 found with cache key EP:ContentVersion:73145. Expected type EPiServer.DataAbstraction.Internal.DefaultContentVersionRepository+CachedVersionList, EPiServer, Version=10.10.1.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
Stack trace:
[InvalidOperationException: Unknown object of type System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 found with cache key EP:ContentVersion:73145. Expected type EPiServer.DataAbstraction.Internal.DefaultContentVersionRepository+CachedVersionList, EPiServer, Version=10.10.1.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
at EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.TryGetWithWait[T](IObjectInstanceCache cache, String cacheKey, T& instance)
at EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.TryGet[T](IObjectInstanceCache cache, String cacheKey, ReadStrategy strategy, T& instance)
at EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.ReadThroughWithWait[T](IObjectInstanceCache cache, String cacheKey, Func1 readValue, Func2 evictionPolicy)
at EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.ReadThrough[T](IObjectInstanceCache cache, String key, Func1 readValue, Func2 evictionPolicy, ReadStrategy readStrategy)
at EPiServer.DataAbstraction.Internal.DefaultContentVersionRepository.List(VersionFilter filter, Int32 startIndex, Int32 maxRows, Int32& totalCount)
at EPiServer.Core.IContentVersionRepositoryExtensions.List(IContentVersionRepository contentVersionRepository, ContentReference contentLink)
at BlockBreadcrumbs.ContentExtensions.LastVersion(IContent content)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at BlockBreadcrumbs.ContentExtensions.CheckUnpublished(IContent content, IContentRepository repo)
at BlockBreadcrumbs.ContentExtensions.GetReferenceTree(IContent content, IContentRepository repo, Int32& totalNumberOfReferences)
at BlockBreadcrumbs.BreadcrumbHelper.RenderBlockBreadcrumbs(HtmlHelper htmlHelper, IContent currentBlock)
at ASP._Page_Views_Preview_Index_cshtml.Execute() in d:\websites\AgeUK-BrandPartners\Views\Preview\Index.cshtml:line 40
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.StartPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.b__1e(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Localize text

If possible, localize the texts to the editor's display language setting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.