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

Cannot access disposed IServiceProvider #1701

Closed
usercode opened this issue Aug 25, 2021 · 3 comments
Closed

Cannot access disposed IServiceProvider #1701

usercode opened this issue Aug 25, 2021 · 3 comments
Assignees
Milestone

Comments

@usercode
Copy link

Hi,

I have some trouble with the manager. It's not possible to open (and edit) some pages.

System.ObjectDisposedException: Cannot access a disposed object. Object name: 'IServiceProvider'.

grafik

But these pages are visible at the frontend. It's just a manager issue.

If you need more information, tell me.

Piranha: 9.1.1
.NET 5.0

@tidyui
Copy link
Member

tidyui commented Aug 25, 2021

We can’t reproduce the error in a new project. The error message means that the service provider has been disposed when the transformation tries to initialize the model. Have you configure the service collection in a custom way or are you using a third part service container?

Regards

@usercode
Copy link
Author

Hey, thanks for your fast response!

I created a new piranha project with my models and regions:

https://drive.google.com/file/d/19sq8Cba9OzQhNCwFaHIKHWJ4wRRhAq7R/view?usp=sharing

How to reproduce:

  • start the project
  • open manager
  • add BrandPage
  • add Product to BrandPage
  • Publish ->Failed

If you remove the property "ImageSize" (SelectField) of ProductItem, it works.

I hope that helps.

@tidyui tidyui added this to the Version 10.0 milestone Oct 12, 2021
@tidyui tidyui self-assigned this Oct 12, 2021
@tidyui
Copy link
Member

tidyui commented Oct 19, 2021

I found the root cause for this. When async init methods are invoked they are not awaited properly which in some cases can cause the service provider to go out of scope before the method has executed.

@tidyui tidyui closed this as completed in f5f7c46 Oct 19, 2021
@tidyui tidyui added bug and removed investigate labels Oct 24, 2021
@tidyui tidyui changed the title Manager: Cannot access a disposed object (IServiceProvider) Cannot access disposed IServiceProvider Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants