Alright, I thought I had a valid reason to start a BackgroundTransfer from my Background Agent. Sadly it doesn’t work. After a small discussion with Ilija Injac he pointed me to Unsupported APIs for Background Agents page on MSDN. Though when trying to find something based on the Exception I couldn’t find anything.
The message I got was: Operation is not valid due to the current state of the object.
With the following StackTrace:
at Microsoft.Phone.BackgroundTransfer.BackgroundTransferRequest.SubmitHelper() at Microsoft.Phone.BackgroundTransfer.BackgroundTransferRequest.Submit() at Microsoft.Phone.BackgroundTransfer.BackgroundTransferService.Add(BackgroundTransferRequest request) at MC.PodCast.Common.Services.Download.DownloadService.Enqueue(Boolean eventLess) at MC.PodCast.Common.Services.Download.DownloadService.<Start>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MC.PodCast.TaskAgent.ScheduledAgent.<<OnInvoke>b__3>d__4.MoveNext()
Hope this helps when you get an exception like the above. It’s just not supported to start a BackgroundTransfer from a Background Agent. Better luck next time.