任务数量是否有限制?

时间:2012-04-14 20:37:34

标签: c# windows-runtime task

我正在运行一个包含多个任务的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特有的问题吗?

有解决方法吗?

1 个答案:

答案 0 :(得分:2)

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

鉴于此,您可能希望首先查看任务管理器,看看您的应用程序是否使用了完全不合理的内存量(或者是否有其他进程)。如果您的进程存在内存泄漏,则可能会导致此问题。