【发布时间】:2012-07-30 18:16:24
【问题描述】:
我目前正在运行一个简单的代码和平,它呈现部分视图并将结果添加到 ConcurrentBag:
Threading.Tasks.Parallel.For(0, Model.Count,
Sub(i)
carXmls.Add(Html.Partial("PublisherVehicleXml16", Model(i)))
End Sub)
可悲的是,这个东西每隔一段时间就会崩溃,但会出现以下异常:Stack empty.
这种情况会间歇性发生,并且仅在我们的暂存和生产环境中发生。任何想法可能来自哪里?
编辑: carsXmls 是这样声明的:
Dim carXmls As New Collections.Concurrent.ConcurrentBag(Of MvcHtmlString)
完全的例外是:
消息堆栈为空。
来源系统
目标网站 T Pop()
堆栈跟踪 在 System.Collections.Generic.Stack
1.Pop() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.b__19() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 继续)在 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext、IList`1 过滤器、ActionResult actionResult) 在 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
【问题讨论】:
-
carXmls变量的类型是什么? -
你能发布完整的异常,包括它的堆栈跟踪吗?
-
我已编辑问题以提供更多信息
-
鉴于堆栈跟踪是否应将 [asp.net-mvc] 添加为标签?还是 [剃刀] 够了吗?
标签: asp.net-mvc vb.net razor task-parallel-library