2012-04-14 89 views
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特有的问题吗?

是否有解决方法?

+0

分享一些代码?我相信通过在调试模式下运行应用程序,您可以看到引发异常的位置 – sll 2012-04-14 20:58:56

+0

请记住,.Net任务在同步上下文中运行。在你的情况下,同步上下文是UI线程(你看到这是因为它调用CoreDispatcher.InvokeAsync)。这意味着你的所有任务将在UI线程上串行运行。这是你的意图吗? – 2012-04-16 15:44:23

回答

2

根据the MSDN documentation for that error message,该错误的修复方法是“关闭某些应用程序”或“增加分页文件的大小”。

鉴于此,您可能需要先查看任务管理器并查看您的应用程序是否正在使用完全不合理的内存量(或其他某个进程)。如果你的进程有内存泄漏,可能会导致这个问题。

相关问题