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