I seem to be having an odd issue w/ the ApplicationDeployment.CheckForUpdateAsync Method. I have it, currently, on a timer, that checks the server for an update at a predetermined interval. The reason for this is that we need to ensure everyone is on the latest release, and when a new release is available, to notify everyone that it’s available.
However, while it works fine if the server is online, if there is a networking error, or the server goes offline during the check, .NET returns a Socket or WebException error.
I have tried to catch the errors:
try
{
_ad.CheckForUpdateAsync();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
For example, but even if i put WebException or any other type of exception in that catch, it doesn’t seem to catch it. I assume that’s because the CheckForUpdateAsync() takes place on a seperate thread.
Is there any way to reliably catch those errors so i do not have random .NET errors popping up during operation?
you can check errors on ApplicationDeployment.CheckForUpdateAsync Method by adding
CheckForUpdateCompletedeven as belowin the
you can find
InvalidDeploymentExceptionandDeploymentDownloadExceptiondetails from the Error property of the CheckForUpdateCompleted event.