System.AggregateException: A task was canceled.

May 11, 2014 at 11:26 AM
Hi Henric i am trying to your new solution(commit 69ed5270195c, 5 days ago). It's working for SamplePlayer.WP8 but its not run in my project :S. I'm copy 5 files Sm.media,Sm.Media.Builder, Sm.Media.MediaPlyer.Wp8, Sm.Media Platform.Wp8,Sm.TsParser. Firstly i am try my m3u8 tv link(http://doguslive-i.akamaihd.net/hls/live/205667/e2sd/stream1/streamPlaylist.m3u8) its not work like this:
Image
My link is work for vlc player, and old phonesm dll.
i am click play button again, it's getting exp like this:
Image

Output information:
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{2C8F0750-2265-40B2-A708-E84DDA735E7E}\Install\SM.TsParser.DLL'. Symbols loaded.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Linq.ni.dll'. Symbols loaded.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.Extensions.ni.dll'. Symbols loaded.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.IO.ni.dll'. Symbols loaded.
MediaElementWrapper.SetSource(MediaStreamSource)
TsMediaStreamSource.OpenMediaAsync()
Media OpenMediaAsyncCalled: Idle -> Opening at 5/11/2014 2:05:56 PM +03:00
TsMediaManager.OpenMedia()
TsMediaManager.OpenMedia() handler
MediaElementWrapper.mediaElement_CurrentStateChanged(): Opening
MediaStreamFacadeBase.MediaManagerOnStateChange() to OpenMedia: 
TsMediaManager.OpenMediaAsync() state OpenMedia
MediaStreamFacadeBase.MediaManagerOnStateChange() to Opening: 
HttpClientWebReaderManager.DetectContentTypeAsync() url ext "http://doguslive-i.akamaihd.net/hls/live/205667/e2sd/stream1/streamPlaylist.m3u8" type M3U8 (application/vnd.apple.mpegurl)
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Net.Requests.ni.dll'. Symbols loaded.
A first chance exception of type 'System.NotSupportedException' occurred in System.Net.Http.DLL
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.NotSupportedException' occurred in SM.Media.DLL
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll
PlaylistSegmentManagerFactory.SetMediaSource(): unable to load playlist: HttpClientHandler.AutomaticDecompression is not supported on this platform.  Please check HttpClientHandler.SupportsAutomaticDecompression before using HttpClientHandler.AutomaticDecompression.
A first chance exception of type 'System.NotSupportedException' occurred in SM.Media.DLL
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll
TsMediaManager.OpenMediaAsync failed: HttpClientHandler.AutomaticDecompression is not supported on this platform.  Please check HttpClientHandler.SupportsAutomaticDecompression before using HttpClientHandler.AutomaticDecompression.
A first chance exception of type 'System.AggregateException' occurred in SM.Media.DLL
A first chance exception of type 'System.AggregateException' occurred in mscorlib.ni.dll
AsyncFifoWorker.WorkHandle.RunAsync() work should not throw exceptions: System.AggregateException: HttpClientHandler.AutomaticDecompression is not supported on this platform.  Please check HttpClientHandler.SupportsAutomaticDecompression before using HttpClientHandler.AutomaticDecompression.
   System.NotSupportedException: HttpClientHandler.AutomaticDecompression is not supported on this platform.  Please check HttpClientHandler.SupportsAutomaticDecompression before using HttpClientHandler.AutomaticDecompression.
   System.NotSupportedException: HttpClientHandler.AutomaticDecompression is not supported on this platform.  Please check HttpClientHandler.SupportsAutomaticDecompression before using HttpClientHandler.AutomaticDecompression.

MediaStreamFacadeBase.MediaManagerOnStateChange() to Error: Unable to play media
TsMediaStreamSource.CloseMedia()
Media CloseMediaCalled: Opening -> Closing at 5/11/2014 2:06:00 PM +03:00
TsMediaStreamSource.CloseMediaHandler()
TsMediaManager.CloseMedia()
TsMediaManager.CloseAsync()
TsMediaManager.CloseAsync() calling _mediaStreamSource.CloseAsync()
MediaElementWrapper.MediaElement_MediaFailed()
TsMediaStreamSource.CloseAsync(): open 0 close RanToCompletion
MediaElementWrapper.Close()
MediaStreamFacadeBase.RequestStop()
MediaStreamFacadeBase.MediaManagerOnStateChange() to Closed: 
MediaStreamFacadeBase.RequestStop()
TsMediaManager.CloseAsync() completed
MediaStreamFacadeBase.CloseMediaAsync()
MediaPlayerSource.CloseMediaAsync() calling mediaManager.CloseAsync()
TsMediaManager.CloseAsync()
TsMediaManager.CloseAsync() completed by other caller
MediaPlayerSource.CloseMediaAsync() returned from mediaManager.CloseAsync()
MediaElementWrapper.mediaElement_CurrentStateChanged(): Closed
MediaStreamFacadeBase.CleanupMediaManager()
TsMediaManager.Dispose()
TsMediaManager.CloseAsync()
TsMediaManager.CloseAsync() completed by other caller
TsMediaManager.Dispose()
TsMediaStreamSource.Dispose()
Media DisposeCalled: Closing -> Idle at 5/11/2014 2:06:00 PM +03:00
The thread 0xd8c has exited with code 259 (0x103).
MediaStreamFacadeBase.CleanupMediaManager() completed
MediaStreamFacadeBase.CloseMediaAsync() completed
MediaStreamFacadeBase.CloseMediaAsync()
MediaStreamFacadeBase.CloseMediaAsync() completed
MediaElementWrapper.Close()
MediaStreamFacadeBase.RequestStop()
MediaStreamFacadeBase.CloseMediaAsync()
MediaStreamFacadeBase.CloseMediaAsync() completed
MediaElementWrapper.Source setter: 
MediaElementWrapper.SetSourceAsync()
MediaStreamFacadeBase.CloseMediaAsync()
MediaStreamFacadeBase.CloseMediaAsync() completed
MediaStreamFacadeBase.OpenMediaAsync()
MediaElementWrapper.Source setter: http://doguslive-i.akamaihd.net/hls/live/205667/e2sd/stream1/streamPlaylist.m3u8
A first chance exception of type 'System.NullReferenceException' occurred in SM.Media.Platform.WP8.DLL
MediaElementWrapper.SetSourceAsync()
MediaStreamFacade.CreateAsync() failed: Object reference not set to an instance of an object.
MediaStreamFacadeBase.CloseAsync()
A first chance exception of type 'System.Threading.Tasks.TaskCanceledException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.Threading.Tasks.TaskCanceledException' occurred in mscorlib.ni.dll
MediaStreamFacade.CreateAsync() failed: A task was canceled.
MediaStreamFacadeBase.CloseAsync()
MediaStreamFacadeBase.CloseMediaAsync()
MediaStreamFacadeBase.CloseMediaAsync() completed
MediaStreamFacadeBase.CloseMediaAsync()
MediaStreamFacadeBase.CloseMediaAsync() completed
A first chance exception of type 'System.AggregateException' occurred in SM.Media.Platform.WP8.DLL
MediaStreamFacadeBase.CloseMediaAsync()
A first chance exception of type 'System.AggregateException' occurred in mscorlib.ni.dll
MediaStreamFacadeBase.CloseMediaAsync() completed
A first chance exception of type 'System.AggregateException' occurred in SM.Media.Platform.WP8.DLL
TaskCollector.Cleanup() task MediaElementWrapper.Source setter failed: System.AggregateException: One or more errors occurred.
   System.AggregateException: A task was canceled.
      System.Threading.Tasks.TaskCanceledException: A task was canceled.
      System.Threading.Tasks.TaskCanceledException: A task was canceled.
   System.AggregateException: A task was canceled.
      System.Threading.Tasks.TaskCanceledException: A task was canceled.
      System.Threading.Tasks.TaskCanceledException: A task was canceled.

A first chance exception of type 'System.AggregateException' occurred in mscorlib.ni.dll
The program '[2584] TaskHost.exe' has exited with code -1 (0xffffffff).
Please help me.
Coordinator
May 11, 2014 at 2:01 PM
Do you have any warnings about missing NuGet packages when compiling your application? I suspect you need to add the HttpClient NuGet package to your application.
May 11, 2014 at 3:47 PM
Ok, but i dont have missing package warnings or any warnings, its compiled and run but when i click play i have this error
Coordinator
May 11, 2014 at 7:56 PM
Edited May 11, 2014 at 8:12 PM
Which version of HttpClient is your app using? The current version on NuGet is 2.2.22; phonesm is still using 2.2.20.

The notes for 2.2.22 mention,
•Fixed an issue with Windows Phone 8.1 when using portable libraries and IWebProxy, DecompressionMethods, or TransportContext.
Your TaskCancelled exception is from how phonesm is shutting things down; the original exception that prevents playback is the
System.AggregateException: HttpClientHandler.AutomaticDecompression is not supported on this platform.  Please check HttpClientHandler.SupportsAutomaticDecompression before using HttpClientHandler.AutomaticDecompression.
I don't know for sure, but it is suspicious that both are related to "decompression".

I'll push an update for phonesm's NuGet packages in a bit, but I have some other pending changes in the tree I need to sort out first.
Marked as answer by mk148a on 5/14/2014 at 4:53 AM
May 14, 2014 at 10:52 AM
Henric, its my fault, i am used to http 1.1.7 client and receive this error "decompression", i am updated http 2.2 on nuget and its works! Thank you for replying.
I will continue to follow your project:)
Coordinator
May 14, 2014 at 5:15 PM
You're welcome.

Good to know what the problem was. I should probably put a note in the documentation somewhere.