skjelbek / block-breadcrumbs Goto Github PK
View Code? Open in Web Editor NEWEPiServer add-on with the purpose of giving editors a better overview and navigation experience when editing blocks.
License: MIT License
EPiServer add-on with the purpose of giving editors a better overview and navigation experience when editing blocks.
License: MIT License
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.WhereSelectEnumerableIterator
2.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(IList
1 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(IList
1 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(IList
1 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, IList
1 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.WrappedAsyncVoid
1.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
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; }
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, Func
2 evictionPolicy)
at EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.ReadThrough[T](IObjectInstanceCache cache, String key, Func1 readValue, Func
2 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.WhereSelectEnumerableIterator
2.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(IList
1 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(IList
1 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, IList
1 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.WrappedAsyncVoid
1.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)
If possible, localize the texts to the editor's display language setting.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.