Concurrency restrictions in the ClickOnce (System.Deployment.Application) APIs

UpdateAsync/CheckForUpdateAsync/DownloadFileGroupAsync are the Async APIs

Update APIs –

UpdateAsync()/CheckForUpdateAsync() CANNOT be invoked if either one of them is already in progress. Exception thrown -InvalidOperationException
i.e An updateAsync() call cannot be made when either a UpdateAsync()/CheckForUpdateAsync() call is in progress within the same process and vice versa.

There is no API/Property to query ClickOnce and find out if an Update/CheckForUpdate operation is in progress. Users can catch the exception or programatically keep track of Update/CheckForUpdate calls withing their process.

OnDemand APIs –

DownloadFileGroupAsync CAN be called concurrently with UpdateAsync/CheckForUpdateAsync methods.
DownloadFileGroupAsync(“Foo”) and DownloadFileGroupAsync(“Bar”) calls CAN be made concurrently within the same process.
DownloadFileGroupAsync(“Foo”) and DownloadFileGroupAsync(“Foo”) CANNOT be made concurrently – again you get an InvalidOperationException.

All restrictions discussed above are for API calls within the same process – there are no interprocess global concurrency restrictions.
Similarly there are no concurrency restrictions between the API calls and ClickOnce scenario updates, so while ClickOnce is downloading an update, the application could also be simultaneously downloading the update using the APIs.

Comments (3)

  1. Anonymous says:

    The behavior pretty much makes sense. I have a slightly off-topic question: Does ClickOnce rely on BITS (Background Intelligent Transfer Service) to run background jobs?

  2. Saurabh says:

    ClickOnce does NOT use the BITS download service. The primary reason for not using BITS was it’s lack of support for the 9X platform.

  3. Darrel says:

    Thanks for this info. If I download multiple file groups asynchronously, but at some point I need to download a specific group immediately, can I cancel the async download of that specific group use the synchronous download to prioritize that one at the top? Will a sychronous download of a group "suspend" current asynch downloads until it is finished?