Migrating to CSLA 8, now ObjectDisposedException for IServiceProvider #4135
Replies: 3 comments 2 replies
-
This is before app.run but after the DI root provider has been created? Are you using a local or remote data portal? |
Beta Was this translation helpful? Give feedback.
-
That won't work as the exception indicates. You must b using a ServiceProvider which gets disposed before the actual application runs. And since all business objects get the service provider from the DI scope they are in they are not in the scope of your app. So disposing the scope to retrieve the lists effectivly kills all retrieved lists due to the now disposed srvice provider. |
Beta Was this translation helpful? Give feedback.
-
The problem was the |
Beta Was this translation helpful? Give feedback.
-
I'm in the process of migrating a Blazor project from .NET 7.0 + CSLA 7.0.4 to .NET 8.0 + CSLA 8.2.5.
After a bunch of DAL interfaces and factories are registered with
builder.Services.AddTransient
some lists are loaded in aParallel.ForEach
beforeapp.Run()
.This has been working for a long time with .NET 7.0, but now it's throwing
System.ObjectDisposedException
andIServiceProvider
is the ObjectName. Disabling the parallel for withmaxParallelism = 1
doesn't fix it.I've read Upgrading to CSLA 8 and looked at
Program.cs
in the BlazorExample to see if I'm missing something. Can anyone point me in the right direction?Beta Was this translation helpful? Give feedback.
All reactions