Critical Issue on PostProcessUpdation

Topics: Updater Application Block
Jan 5, 2005 at 5:32 AM
originally posted by: Jemon

Sub : Critical Issue on PostProcessUpdation in Updater Application Block

My Windows Application is working Using the Updater Application Block which includes PostProcessUpdation. PostProcess Class is working fine for simple cases.

The problem describes below:-

My Application Name – MyApp.exe
My Post Process Assembly & Class – MyPostProcess.MyPostProcess


After downloading MyApp.exe version 2.0, it generates a text file named Text.txt by running the code inside MyPostProcess() which has some data and it will be used by MyApp.exe version 2.0. But I found a critical problem that before finish up with Text.txt, if my application cracks, it won’t creates the Text.txt file but MyApp.exe version 2.0 is there at client side. Since the version 2.0 is running at client side anymore, it refers Text.txt file and it got terminated as there is no Text.txt file. And the MyApp.exe doesn’t start for download as there is no Version 3.0 available in server.

Would anyone please suggest a solution to over come this kind of critical problem?

Jan 5, 2005 at 11:26 AM
originally posted by: nyajaman

Let me restate the issue to confirm that I understand the issue correctly -

-- You have a post processor that creates a .txt file containing some data that is used by the program. Your post processor might fail halfway thru the generation of the .txt file. The new version of the application that uses the .txt file may fail to work correctly the next time you start it. --

The Updater internally maintains a task for each update that is being performed. This task called UpaterTask has a state stored in it. This state indicates what step in the update process has been completed.

In your case the UpdaterTask state will indicate "ActivationError" state since your post processing did not complete successfully. The next time you start the update process the post processing will be restarted and try to complete - as the state of the task is not set to "ActivationCompleted". Only after the activation is completed successfully the update is considered complete. The IActivationProcessor interface (implemented by the processors) supports a method that you can use to run before performing any processing to ensure that you can perform the post processing successfully.

You need to pay special attention to the order of the post processors in cases where you expect such a situation.

Also consider what would be the best way to update the app - should you use a stub application to update or should you use in proc.