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 a disposed object #567

Closed
a641545621 opened this issue May 30, 2018 · 3 comments
Closed

Cannot access a disposed object #567

a641545621 opened this issue May 30, 2018 · 3 comments

Comments

@a641545621
Copy link

1
2
3
4

How should I set to solve this problem?

Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling Dispose() on the context, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
Object name: 'RepositoryDbContext'.

@mguinness
Copy link
Collaborator

Unsure this is a provider issue. See if you can replicate using SQLite EF Core Database Provider.

@antonioortizpola
Copy link
Contributor

Mmmm, i do not know if that afects, but you are not using async right, you should be using Tasks, not Threads, and Task.Delay, not Thread.Sleep.
Your async method should return Task, not void, and if you could post the code as text and not as image could make easier for us to make some notes!, But like @mguinness i bet the problem is not in the provider

@caleblloyd
Copy link
Contributor

caleblloyd commented May 30, 2018

@antonioortizpola is right, the async void is more than likely the issue, it needs to be async Task and should be awaited in the Controller. Controller also needs to be made async.

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

4 participants