tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Windows 8/8.1 background API mismatch

16 Sep 2013 .NET, WinRT, Windows

While digging into some background stuff in WinRT I found some mismatch in API. It’s not something that’s completely different. Both APIs deal with some background operations, both having same prefix “Background” (although in different namespace). Have a look yourself.

The first background operations is dealing with uploads and downloads. When you want to list all (in this case) background operations, you can call BackgroundDownloader.GetCurrentDownloadsAsync(). This method returns IAsyncOperation<IReadOnlyList>. Aka it’s asynchronous and it’s a method.

The other one is dealing with background tasks. And when you want to all background tasks, you can call BackgroundTaskRegistration.AllTasks. This method returns simple IReadOnlyDictionary<Guid, IBackgroundTaskRegistration>. Aka it’s synchronous and it’s a property.

Maybe I’m too pesky. But these are not that different from developer’s point of view, isn’t it? Why is then one method and other property? And why there’s a mismatch between synchronous call and asynchronous call (though I can imagine one is reading just some application’s related piece of memory while the other one is doing some call though system to some “background transfer service”, but still …)?