Castle.MicroKernel.CircularDependencyException when resolving MvcRouteHandler
See original GitHub issueHello! I got a question. Abp.Boilerplate, v 3.9.0 Why am i getting Castle.MicroKernel.CircularDependencyException on
app.UseMvc(routes =>
{
routes.MapRoute(
name: "defaultWithArea",
template: "{area}/{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
with breaking on exceptions turned on? How do i get rid of it? As far as I understood, the exception is thrown when resolving MvcRouteHandler. Full exception message is
Dependency cycle has been detected when trying to resolve component 'Microsoft.AspNetCore.Razor.Language.RazorProjectEngine_143cff80-96bf-4aa2-80fc-af7373a01ca6'.
The resolution tree that resulted in the cycle is the following:
Component 'Microsoft.AspNetCore.Razor.Language.RazorProjectEngine_143cff80-96bf-4aa2-80fc-af7373a01ca6' resolved as dependency of
component 'Microsoft.AspNetCore.Razor.Language.RazorEngine_e513da7d-e020-4ea6-925d-e4c5c69c3bee' resolved as dependency of
component 'Microsoft.AspNetCore.Mvc.Razor.Internal.LazyMetadataReferenceFeature_5cbf1bf2-21ea-4c01-9186-70edda5f81ff' resolved as dependency of
component 'Microsoft.AspNetCore.Razor.Language.RazorProjectEngine_143cff80-96bf-4aa2-80fc-af7373a01ca6' resolved as dependency of
component 'Microsoft.AspNetCore.Mvc.Razor.Compilation.IViewCompilerProvider_08cd7c5c-c9cf-4a5e-a5aa-12aec9f1961b' resolved as dependency of
component 'Microsoft.AspNetCore.Mvc.Razor.IRazorPageFactoryProvider_c1da251e-97e1-41d8-adc2-9d9ea0d9242c' resolved as dependency of
component 'Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine_4bdad906-7788-4ff0-8bc0-4af945e4a625' resolved as dependency of
component 'Microsoft.Extensions.Options.IConfigureOptions`1[[Microsoft.AspNetCore.Mvc.MvcViewOptions, Microsoft.AspNetCore.Mvc.ViewFeatures, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]_ad494af2-5ab1-43d8-944f-8d612001e90b' resolved as dependency of
component 'Microsoft.Extensions.Options.IOptionsFactory`1_ebc4dd86-b18c-422a-8986-a406cad4eb42' resolved as dependency of
component 'Microsoft.Extensions.Options.IOptionsFactory`1_ebc4dd86-b18c-422a-8986-a406cad4eb42' resolved as dependency of
component 'Microsoft.Extensions.Options.IOptions`1_d8f88dbb-e8a9-4196-abf8-9b7398343629' resolved as dependency of
component 'Microsoft.Extensions.Options.IOptions`1_d8f88dbb-e8a9-4196-abf8-9b7398343629' resolved as dependency of
component 'Microsoft.AspNetCore.Mvc.ApplicationModels.IPageApplicationModelProvider_47b77ab4-c4c0-4b1f-b306-1dd46aa082be' resolved as dependency of
component 'Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.IPageLoader_930a8b19-9481-41d1-b412-9ba32a232960' resolved as dependency of
component 'Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider_8784d307-44bc-4edb-8a61-f3127ad49b79' resolved as dependency of
component 'Microsoft.AspNetCore.Mvc.Infrastructure.IActionInvokerFactory_4961e9f6-9ade-4a98-9e3e-4de3f80bac3c' resolved as dependency of
component 'Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler_d7531031-381e-4ff3-b56c-3568a38854a3' which is the root component being resolved.
Issue Analytics
- State:
- Created 5 years ago
- Comments:27 (13 by maintainers)
Top Results From Across the Web
Castle.MicroKernel.CircularDependencyException #5614
Castle.MicroKernel.CircularDependencyException #5614 ... Dependency cycle has been detected when trying to resolve component 'Microsoft.
Read more >Erroneous Circular Dependency exception - resolving ...
I am using a factory to resolve components in Castle Windsor (with arguments) and it works fine normally. However, the (transient) instance ...
Read more >Problem with Castle Windsor resolution in ASP.NET Core
Castle Windsor allows us to decorate a property with a DoNotWire attribute that instructs the resolver to ignore this property.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try this:
AbpPropertiesDependenciesModelInspector
class as shown below:Startup.cs
, add following code in theservices.AddAbp...
options:See my commit for exact code: https://github.com/aspnetboilerplate/aspnetboilerplate/commit/1270e6766905994b69e1e2b8fe2d40ffeacb817d
If this works properly, we may include it into the framework. I know that Microsoft team ignores property injection, so the property injection shouldn’t work for Microsoft types.
It works well. Thanks. 感谢大佬。 https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3569#issuecomment-402738621