Ich führe ein Winrt-Programm mit mehreren Aufgaben. In der Mitte des Laufens, erhalte ich die folgende Ausnahme:Ist die Anzahl der Aufgaben begrenzt?
Not enough quota is available to process this command
Der Stack-Trace ist
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()
Dann stürzt.
Ist dies ein spezifisches Problem für WinTRT?
Gibt es eine Problemumgehung?
Teilen Sie Code? Ich glaube, indem Sie eine Anwendung im Debug-Modus ausführen, können Sie sehen, wo die Ausnahme ausgelöst wurde – sll
Denken Sie daran, dass .Net-Aufgaben in einem Synchronisationskontext ausgeführt werden. In Ihrem Fall ist der Synchronisationskontext der UI-Thread (Sie sehen dies, weil er CoreDispatcher.InvokeAsync aufruft). Das bedeutet, dass alle Ihre Aufgaben im UI-Thread seriell ausgeführt werden. Ist das beabsichtigt? –