MVC部分视图中的StackOverflowException

时间:2013-10-21 15:41:17

标签: asp.net-mvc unity-container

我在MVC Partial View上遇到了StackOverflowException。我们还通过Unity使用实体框架和依赖注入。

只有在我的Kendo Tabstrip中有动作时才会发生这种情况,如下所示:

@(Html.Kendo().TabStrip()
    .Name("mainNav")
    .HtmlAttributes(new { @class = "mainnav" })
    .Animation(false)
    .Items(i =>
    {
        i.Add().Text("Home").Action("Dashboard", "Home");
        i.Add().Text("Clients").Action("Manage", "Household");
        i.Add().Text("Properties").Action("Manage", "Property");
        i.Add().Text("Financial").Action("FinancialSummary", "Financial");
        i.Add().Text("Payables").Action("Manage", "PurchaseOrder")
            .Content(Html.Partial("~/Views/PurchaseOrder/_ManageContent.cshtml").ToString());
        i.Add().Text("Maintenance").Action("Manage", "WorkOrder");
        i.Add().Text("Capital Planning").Action("Index", "CapitalPlanning");
    })
)

如果我只是简单的行动,例如i.Add().Text("Home"),它就可以了。

异常不想向我展示调用堆栈(“无法评估表达式,因为线程处于堆栈溢出状态”),但我最终想到了在Visual Studio中调用堆栈选项卡。从那里,调用堆栈看起来像这样:

Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(Microsoft.Practices.ObjectBuilder2.NamedTypeBuildKey newBuildKey) + 0x1f3 bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xad bytes    
[Lightweight Function]  
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x47 bytes    
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0x30a bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext context) + 0xcd bytes  
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.UnityContainer.DoBuildUp(System.Type t, object existing, string name, System.Collections.Generic.IEnumerable<Microsoft.Practices.Unity.ResolverOverride> resolverOverrides) + 0x285 bytes   
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.UnityContainer.DoBuildUp(System.Type t, string name, System.Collections.Generic.IEnumerable<Microsoft.Practices.Unity.ResolverOverride> resolverOverrides) + 0x4e bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.UnityContainer.Resolve(System.Type t, string name, Microsoft.Practices.Unity.ResolverOverride[] resolverOverrides) + 0x46 bytes 
Microsoft.Practices.Unity.dll!Microsoft.Practices.Unity.UnityContainerExtensions.Resolve(Microsoft.Practices.Unity.IUnityContainer container, System.Type t, Microsoft.Practices.Unity.ResolverOverride[] overrides) + 0x71 bytes   
Unity.Mvc3.dll!Unity.Mvc3.UnityDependencyResolver.GetService(System.Type serviceType) + 0x9f bytes  
System.Web.Mvc.dll!System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(System.Web.Routing.RequestContext requestContext, System.Type controllerType) + 0x97 bytes 
System.Web.Mvc.dll!System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(System.Web.Routing.RequestContext requestContext, System.Type controllerType) + 0x2b2 bytes    
System.Web.Mvc.dll!System.Web.Mvc.DefaultControllerFactory.CreateController(System.Web.Routing.RequestContext requestContext, string controllerName) + 0x15b bytes  
Kendo.Mvc.dll!Kendo.Mvc.Infrastructure.Implementation.ControllerContextCache.ControllerContextFactory(System.Web.Routing.RequestContext requestContext, string controllerName, string areaName) + 0x99 bytes        

1 个答案:

答案 0 :(得分:0)

似乎Kendo操作与问题无关,除了足够来触发Bootstrapper和依赖注入。由于我们其余的大多数视图都只是在Tabstrip中,因此没有其他任何机会可以执行。

虽然错误被抛到了视图中,但真正的问题是我们服务中的循环引用,例如:

public class ServiceA : IServiceA
{
    private readonly IServiceB _svcB;

    public ServiceA(IServiceB svcB)
    {
        _svcB = svcB
    }
}

public class ServiceB : IServiceB
{
    private readonly IServiceA _svcA;

    public ServiceB(IServiceA svcA)
    {
        _svcA = svcA
    }
}

当然,我们的层次结构有点复杂,因此,异常的来源不太明显(特别是因为异常是在View中抛出而不是在实际的Service中)。

要解决这个问题,我会注入基本存储库,或者将一些常用功能移到自己的服务中。但由于真正的斗争只是确定错误发生的原因,我希望这能节省一些时间!