System ShutDown..

V

VJ

Our application writes pretty large XML files to local file store.. I would
say anywhere between 3-5MB of data at time.. but nothing more...The
DataSet.WriteXML() method in the framework, corrupts the files when System
is shutting down. What I mean here is the file does not get flushed
properly, I see a corrupted XML file written. So if the system shutdown has
started how do I prevent the DataSet file being not written. I have tried to
prevent this from happening by making sure that, I create a back file and
only the new file if there is a success of creating a back up. After I
successfully create the new file then I delete the backup to keep the
original. Some how 3 out 10 times in testing, I get both my backup and the
original file corrupted.

I also know that when shutdown beings the .NET domain unloads and commands
get executed. But if that is the case, why is the Write XML being corrupted?
Can't the WriteXML not flush the file or do something to write the full file
or nothing. Is there a known bug? We do have a mechanism for databack up in
our system. But Sometimes, when system shutdowns and if our application is
performing a operation that has sequences of commands that write to both
original and backup, then both locations get messed up. I guess it almost
comes down to the point that I should write to both locations in way that
the .NET domain or the CLR does not execute these commands on shutdown or
unload. Anybody experience such problems with .NET and have implemented a
solution?

Thanks
Vijay
 
V

VJ

Thank you .. That is what I was looking for ..

But this still will not handle the case of force shutting down?. i.e like
press and hold the power button till shut off.

Vijay
 
M

Markus Kling

You can NEVER prevent that fault. The system can always be (and even will
be) in an unstable state. Even if all devices are able to perform their
queued operations battery backuped you have no chance to be sure that the
overall state is logically correct.

If you pull the plug you must be aware of that you pulled the plug ;)

Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top