5
我正在运行一个包含多个任务的winrt程序。 在运行中间,我得到以下异常:是否有任务数量的限制?
Not enough quota is available to process this command
堆栈跟踪为
at Windows.UI.Core.CoreDispatcher.InvokeAsync(CoreDispatcherPriority priority, InvokedHandler freeThreadedCallback, Object sender, Object context)
at System.Threading.WinRTSynchronizationContext.Post(SendOrPostCallback d, Object state)
at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.InvokeOrPostAction(Object state)
at System.Threading.Tasks.AwaitTaskContinuation.RunInline(ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.AwaitTaskContinuation.<ThrowAsyncIfNecessary>b__1(Object s)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
然后崩溃。
这是WintRT特有的问题吗?
是否有解决方法?
分享一些代码?我相信通过在调试模式下运行应用程序,您可以看到引发异常的位置 – sll 2012-04-14 20:58:56
请记住,.Net任务在同步上下文中运行。在你的情况下,同步上下文是UI线程(你看到这是因为它调用CoreDispatcher.InvokeAsync)。这意味着你的所有任务将在UI线程上串行运行。这是你的意图吗? – 2012-04-16 15:44:23