Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LifetimeScope has already been disposed #2

Open
MatteoPiovanelli-Laser opened this issue Dec 6, 2019 · 1 comment
Open

LifetimeScope has already been disposed #2

MatteoPiovanelli-Laser opened this issue Dec 6, 2019 · 1 comment

Comments

@MatteoPiovanelli-Laser
Copy link

Hello,

We are trying to set up an ItemLevelCachePart on a MenuWidget.
The Menu that will display has one item that changes for each user base on the content of a ContentPickerField set on the user.

@*This code is in the shape for a menu item*@
var useritem = (dynamic)(WorkContext.CurrentUser.ContentItem);
// User has a Part called ProfilePart
if (useritem.ProfilePart.MyCPF.ContentItems != null && useritem.ProfilePart.MyCPF.ContentItems.Length >0 ) {
    // personalize menu here
}

The call to useritem.ProfilePart.MyCPF.ContentItems goes though that property's Loader, that does _contentManager.GetMany(/**/). That call fails as soon as it tries to get the current sessions with the following error:

Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.

I've already tried replacing that call to the LazyField with an explicit call to _contentManager.GetMany(/**/), but I see the same error.

I will look a bit more into that.

@MatteoPiovanelli-Laser
Copy link
Author

More details:

It looks like the delegate factory that is used in SessionLocator to return a new ContentManagerSession has already been disposed of when the code is calling this from the TransformStream delegate that is being set in PlaceholderResolutionFilter.OnResultExecuted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant