November Happy Hour will be moved to Thursday December 5th.

DefaultContentLoader.TryGet throws ContentNotFoundException

tss
tss
Vote:
 

Hi

Can it really be true that the DefaultContentLoader.TryGet method on the should rethrow the exception if the content isn't found?

From what I can see in the code it throws the exception again after raising the "FailedLoadingContentEvent"

normally I would expect a TryGet method to handle exceptions and return false if the action failed.

#133434
Sep 04, 2015 12:05
tss
Vote:
 

forgot to mention that our EPiServer assembly version is 8.5.0.0

#133436
Sep 04, 2015 12:06
tss
Vote:
 

From what I can see in the stack trace:

Exception information:
    Exception type: ContentNotFoundException

    Exception message: Content with id 782__webgroups was not found

   at EPiServer.Core.DefaultContentLoader.Get[T](ContentReference contentLink, LoaderOptions loaderOptions)

   at EPiServer.Core.ContentLanguageSettingsHandler.GetClosestSettingNoCache(ContentReference contentLink, Dictionary`2 allSettings)

   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)

   at EPiServer.Core.ContentLanguageSettingsHandler.GetClosestSetting(ContentReference contentLink)

   at EPiServer.Core.ContentLanguageSettingsHandler.Get(ContentReference contentLink)

   at EPiServer.Core.ContentLanguageSettingsHandler.Get(ContentReference contentLink, String languageBranch)

   at EPiServer.Core.LanguagePipeline.Pipe(ContentReference contentLink, IContent contentInstance, LoaderOptions loaderOptions, Func`3 loadingDelegate)

   at EPiServer.Core.ProviderPipelineImplementation.GetItem(ContentProvider provider, ContentReference contentLink, LoaderOptions loaderOptions)

   at EPiServer.Core.DefaultContentLoader.TryGet[T](ContentReference contentLink, LoaderOptions loaderOptions, T& content)

   at EPiServer.Core.Html.StringParsing.ContentFragment.GetContent(Boolean enableMasterLanguageFallback)

   at EPiServer.Core.Html.StringParsing.ContentFragment.GetSecurityDescriptor()

   at EPiServer.Core.Html.StringParsing.StringFragmentCollection.AddFilteredFragment(String contentGroup, List`1 filteredFragments, IStringFragment fragment, ISecurable securable, IPrincipal principal)

   at EPiServer.Core.Html.StringParsing.StringFragmentCollection.GetFilteredFragments(IPrincipal principal)

   at EPiServer.Core.ContentArea.get_FilteredItems()

ContentArea.FilteredItems failes if the contentArea contains elements that have been deleted.

in our case the item is from a external provider and we are using the MappedItdentiy utility to map it to ContentReferences

when calling the ContentFragment.GetSecurityDescriptor() it loads the IContent by calling GetContent()

but the handling in that method doesn't use try{}catch(){} around the TryGet method call

so its possible to get a ContentNotFoundException when you have a none empty ContentReference where the Content doesn't exist anymore.

#133444
Sep 04, 2015 14:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.