InvalidOperationException與Task.RunSynchronously Method

  • 661
  • 0

InvalidOperationException與Task.RunSynchronously Method

無論Task.RunSynchronously Method是否包含指定TaskScheduler的參數,一個task只能被啟動和執行一次,倘若企圖再度針對task進行排稱\程,將會拋出例外InvalidOperationException。

參考資料來源:

[1]Task.RunSynchronously Method
http://msdn.microsoft.com/en-us/library/dd321435(v=vs.110).aspx

[2]Task.RunSynchronously Method (TaskScheduler)
http://msdn.microsoft.com/en-us/library/dd449175(v=vs.110).aspx