Search code examples
.netarchitectureerror-handlingrecoverydisaster-recovery

Strategies for implementing recovery mode


I have a Windows application which if it fails, I would like to default to a “recovery mode”, the first time it is run after failing.

I'm ok on flagging the error and the different things the user could do to recover, it's the actual launching of the recovery mode utility that is giving me a headache. I have had a couple of ideas, but I was hoping someone else might have come across a better method.

1) When the main app loads the first thing it does if check for a previous error and then launch the recovery mode utility.

The problem with this is that if there is anything wrong with the app, which is likely, then it will not start up at all.

2) Instead of the main app have the user start up a utility that will check for a previous error, then either launch the main app or go into the recovery mode.

This solves the problem with the first idea, however the target machines are very locked down and there could be deployment issues.

Are there any other strategies for implementing a recover mode?

Thanks


Solution

  • We solved some similar situation as follows :

    • make the "recovery mode utility" the one that is always started by the user
    • the "recovery mode utility" check whether any recovery to do (and if so does it)
    • when either no recovery needed or the recovery is completed successfully the utility launches the real app

    With .NET you can even put both into one EXE... for example with ILMerge (free utility) or by embedding the real app as an "embeddable resource" or by some commercial tool...

    This way for the user there is no difference... and the embedded EXE can be started from memory (no need to extract it to the file system) so for the user it doesn't make any difference until recovery is really needed...

    IF need be for some hints on how to embed and/or start the second EXE from memory let me know - I don't have the links at hand right now but could look them up.