You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am planning to move to asp.net core 3.0, but I got an error message which sounds to be due to breaking changes in asp.net core 3.0.
Unhandled Exception: System.InvalidCastException: Unable to cast object of type'Microsoft.Extensions.DependencyInjection.ServiceCollection' to type'Grace.DependencyInjection.IInjectionScope'.
at Microsoft.Extensions.Hosting.Internal.ConfigureContainerAdapter`1.ConfigureContainer(HostBuilderContext hostContext, Object containerBuilder) at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build() at dry_test.Program.Main(String[] args) in /../Program.cs:line 20
@shahabganji I had forgotten there are some changes I need to do for Asp.Net Core 3.0. So good news is I was able to put together a quick example to prove it works. The down side is it's going to take me a week or two to implement this and the other changes needed to fully support 3.0.
If you can wait a week or two for Grace 7.0-beta to be released I'd hold off. If you want to try out the extension I hacked together this afternoon I can post it.
There is no rush for this and your timing sounds great, I'll stick to the default IOC shipped with ASP.Net Core 3.0 since AFAIK Grace understands what has been registered with the default container so that there would be fewer changes I need to make after you release the beta/final version later on.
I've released a Beta version of Grace and the extension library. The big change is that the UseGrace method was changed to apply to the IHostBuilder instead of the IWebHostBuilder. So your code will need to change to this.
@ipjohnson I tested the beta version. Everything looks to work properly on a test project, I guess this issue can be closed then. I'll come back if I hit any issues on a real project. Enclosed you can find which versions I Have used so that if there are any conflicts you can mention me.
Just one thing to mention, as far as I remember when using scope.SetupMvc( ); in the ConfigureContainer method it automatically registered IHttpContextAccessor am I right? because in the new version I have to register it manually.
Activity
ipjohnson commentedon Mar 16, 2019
Hmmm that’s no good. I’ll see if I can address it this weekend.
ipjohnson commentedon Mar 16, 2019
@shahabganji I had forgotten there are some changes I need to do for Asp.Net Core 3.0. So good news is I was able to put together a quick example to prove it works. The down side is it's going to take me a week or two to implement this and the other changes needed to fully support 3.0.
If you can wait a week or two for Grace 7.0-beta to be released I'd hold off. If you want to try out the extension I hacked together this afternoon I can post it.
shahabganji commentedon Mar 16, 2019
Thanks @ipjohnson for the prompt reply,
There is no rush for this and your timing sounds great, I'll stick to the default IOC shipped with ASP.Net Core 3.0 since AFAIK Grace understands what has been registered with the default container so that there would be fewer changes I need to make after you release the beta/final version later on.
ipjohnson commentedon Mar 30, 2019
I've released a Beta version of Grace and the extension library. The big change is that the UseGrace method was changed to apply to the IHostBuilder instead of the IWebHostBuilder. So your code will need to change to this.
shahabganji commentedon Mar 31, 2019
@ipjohnson I tested the beta version. Everything looks to work properly on a test project, I guess this issue can be closed then. I'll come back if I hit any issues on a real project. Enclosed you can find which versions I Have used so that if there are any conflicts you can mention me.
Just one thing to mention, as far as I remember when using
scope.SetupMvc( );in theConfigureContainermethod it automatically registeredIHttpContextAccessoram I right? because in the new version I have to register it manually.ipjohnson commentedon Apr 1, 2019
I believe it used to be registered automatically somewhere in asp.net core but they stopped doing that. So now you have to register it yourself