tags:

views:

215

answers:

4

Am looking for checkpointing library for C#. Any ideas ?

see http://en.wikipedia.org/wiki/Application_checkpointing

+1  A: 

If I understand you correctly (and the question is pretty vague so I'm not sure of this at all) then Windows Workflow Foundation certainly has this capability. However, it's almost certainly overkill for what you're asking.


Okay, you added a link that better explains what you mean by checkpointing.

With that in mind, .Net doesn't have anything built in to support this directly. However, anything that uses a state machine where the state machine can be persisted, can be inspected/validated, and is transactional has this sort of thing naturally built-in. WWF is one example of that.

Joel Coehoorn
A: 

Given the link from wikipedia, I can tell you .NET/CLR does not support this. What makes this impossible is due to the fact that .NET does not allow you to inspect of modify the application stack which in turn is not possible due to builtin security in .NET.

leppie
It is possible to mimic the functionality by writing the application in a special way, so that it can save the relevant state needed to start from that point later, but it's by no means something you can just plug into the application and build, and you're done.
Lasse V. Karlsen
What you are explaining is not really what the wikipedia link suggests. Anyways, if you feel that way is acceptable, good. Personally, I would not try it, due to hundreds of issues that could pop up (unless we dealing with a small app like minesweeper).
leppie
+1  A: 

I dont think there is built in support for this but it should be relatively easy to build you own. Assuming that you have a central application class that stores your applications state, or at least the part used in the checkpointing. Then you could use serialization to store the state of your application whenever required. Further, it would be easy to store the snapshots in a database of a file if you needed it later. But this would require you to write your own library to support it.

As I write this I start feeling that there must be some support for this in the framework. Look at the System.Transactions namespace for instance.

Rune Grimstad
+2  A: 

This should be possible to implement using transactions (commit/rollback) or undo. If you design your classes and operations correctly it will work, it will require some hard work and discipline using the classes of course. You'll also need to be careful about exceptions.

The System.Transactions namespace (as Rune suggested) seems to be a good candidate, or atleast a good starting point.

dalle