Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > The persistUpdateCheckResult wasn't added to the CheckForUpdateAsync ??
 

The persistUpdateCheckResult wasn't added to the CheckForUpdateAsync ??

I noticed that the persistUpdateCheckResult override was not added to the CheckForUpdateAsync method only to the CheckForUpdate and CheckForDetailedUpdate methods.
So the synchronous calls get it but not the asynchronous call ??

Was this an oversight?


Thanks.


ColoradoKid
ColoradoKid  Thursday, August 13, 2009 7:32 PM
Hello,

Thanks for you feedback.

I've check this with Reflect and I found that ApplicationDeployment actually call ProcessUpdateCheckResult(), which is a private method, to persist check result in the registry without installing the update. It only checks the Error and the Canceled properties of the CheckForUpdateCompletedEventArgs, it seems there is no way to work around this issue.

private void CheckForUpdateBindCompletedEventHandler(object sender, BindCompletedEventArgs e)
{
Exception error = null;
DeploymentManager manager = null;
bool updateAvailable = false;
Version availableVersion = null;
bool isUpdateRequired = false;
Version minimumRequiredVersion = null;
long updateSize = 0L;
new NamedPermissionSet("FullTrust").Assert();
try
{
manager = (DeploymentManager) sender;
if ((e.Error == null) && !e.Cancelled)
{
TrustParams trustParams = new TrustParams();
trustParams.NoPrompt = true;
manager.DetermineTrust(trustParams);
manager.DeterminePlatformRequirements();
UpdateCheckInfo info = this.DetermineUpdateCheckResult(manager.ActivationDescription);
this.ProcessUpdateCheckResult(info, manager.ActivationDescription);
if (info.UpdateAvailable)
{
updateAvailable = true;
availableVersion = info.AvailableVersion;
isUpdateRequired = info.IsUpdateRequired;
minimumRequiredVersion = info.MinimumRequiredVersion;
updateSize = info.UpdateSizeBytes;
}
}
else
{
error = e.Error;
}
}
catch (Exception exception2)
{
error = exception2;
}
finally
{
CodeAccessPermission.RevertAssert();
Interlocked.Exchange(ref this._guard, 0);
CheckForUpdateCompletedEventArgs args = new CheckForUpdateCompletedEventArgs(error, e.Cancelled, null, updateAvailable, availableVersion, isUpdateRequired, minimumRequiredVersion, updateSize);
CheckForUpdateCompletedEventHandler handler = (CheckForUpdateCompletedEventHandler) this.Events[checkForUpdateCompletedKey];
if (handler != null)
{
handler(this, args);
}
if (manager != null)
{
manager.ProgressChanged -= new DeploymentProgressChangedEventHandler(this.CheckForUpdateProgressChangedEventHandler);
manager.BindCompleted -= new BindCompletedEventHandler(this.CheckForUpdateBindCompletedEventHandler);
new NamedPermissionSet("FullTrust").Assert();
try
{
manager.Dispose();
}
finally
{
CodeAccessPermission.RevertAssert();
}
}
}
}

I've log this feature into our product database, product team will evaluate this in the future. You might also submit this as a feature request in our Connect Portal.

https://connect.microsoft.com/VisualStudio/

Again, thank you for your feedback.

Regards,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Friday, August 14, 2009 6:45 AM
Hello,

Thanks for you feedback.

I've check this with Reflect and I found that ApplicationDeployment actually call ProcessUpdateCheckResult(), which is a private method, to persist check result in the registry without installing the update. It only checks the Error and the Canceled properties of the CheckForUpdateCompletedEventArgs, it seems there is no way to work around this issue.

private void CheckForUpdateBindCompletedEventHandler(object sender, BindCompletedEventArgs e)
{
Exception error = null;
DeploymentManager manager = null;
bool updateAvailable = false;
Version availableVersion = null;
bool isUpdateRequired = false;
Version minimumRequiredVersion = null;
long updateSize = 0L;
new NamedPermissionSet("FullTrust").Assert();
try
{
manager = (DeploymentManager) sender;
if ((e.Error == null) && !e.Cancelled)
{
TrustParams trustParams = new TrustParams();
trustParams.NoPrompt = true;
manager.DetermineTrust(trustParams);
manager.DeterminePlatformRequirements();
UpdateCheckInfo info = this.DetermineUpdateCheckResult(manager.ActivationDescription);
this.ProcessUpdateCheckResult(info, manager.ActivationDescription);
if (info.UpdateAvailable)
{
updateAvailable = true;
availableVersion = info.AvailableVersion;
isUpdateRequired = info.IsUpdateRequired;
minimumRequiredVersion = info.MinimumRequiredVersion;
updateSize = info.UpdateSizeBytes;
}
}
else
{
error = e.Error;
}
}
catch (Exception exception2)
{
error = exception2;
}
finally
{
CodeAccessPermission.RevertAssert();
Interlocked.Exchange(ref this._guard, 0);
CheckForUpdateCompletedEventArgs args = new CheckForUpdateCompletedEventArgs(error, e.Cancelled, null, updateAvailable, availableVersion, isUpdateRequired, minimumRequiredVersion, updateSize);
CheckForUpdateCompletedEventHandler handler = (CheckForUpdateCompletedEventHandler) this.Events[checkForUpdateCompletedKey];
if (handler != null)
{
handler(this, args);
}
if (manager != null)
{
manager.ProgressChanged -= new DeploymentProgressChangedEventHandler(this.CheckForUpdateProgressChangedEventHandler);
manager.BindCompleted -= new BindCompletedEventHandler(this.CheckForUpdateBindCompletedEventHandler);
new NamedPermissionSet("FullTrust").Assert();
try
{
manager.Dispose();
}
finally
{
CodeAccessPermission.RevertAssert();
}
}
}
}

I've log this feature into our product database, product team will evaluate this in the future. You might also submit this as a feature request in our Connect Portal.

https://connect.microsoft.com/VisualStudio/

Again, thank you for your feedback.

Regards,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Friday, August 14, 2009 6:45 AM

Thanks for the prompt reply and follow-up.

Would you not agree that this is 'Coding OmissionBug' not a 'Feature' ?

Since the intent of the original Override was to optionally eliminate the check resultsave during update check and the'Skip dialog' on relaunch.
The only difference to the three methods is one is asynchronous and uses events to status the othertwo don't (other than the level of detail of course).

ApplicationDeployment.CurrentDeployment.CheckForUpdate(false)
ApplicationDeployment.CurrentDeployment.CheckForDetailedUpdate(false)
ApplicationDeployment.CurrentDeployment.CheckForUpdateAsync() *no override allowed - coding omission bug*

I will post this as you suggest but not as a 'Feature' but as a 'Bug' since the three methods should be identical.

Thanks again.


ColoradoKid
ColoradoKid  Friday, August 14, 2009 6:31 PM

You can use google to search for other answers

Custom Search

More Threads

• Within ClickOnce: SQL server needs to be programmatically set for SQL authentication and Windows authentication
• Cannot launch ClickOnce appliation on another network
• OnBeforeInstall and installing EXE side by side with previous version
• How to install programmatically *.vsto (ClickOnce Office add-ins)?
• Unable to deploy the winapp
• Changing ClickOnce update/publish location
• Mixed Assemblies SideBySide on Service Start Error
• Using registry search and launch condition regading to C# (Solved)
• How to check the .net framework as launch condition (if .net have been removed)
• Security Error while installing ClickOnce application