Home All Groups Group Topic Archive Search About
Author
22 Jun 2006 8:57 PM
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

Author
23 Jun 2006 9:05 AM
Markus Kling
Vijay,

you can find a good description on how to react and cancel system events at
http://www.codeproject.com/csharp/systemeventshandler.asp.

Markus


Show quote
"VJ" <vijayba***@yahoo.com> schrieb im Newsbeitrag
news:e%23bw55jlGHA.4268@TK2MSFTNGP05.phx.gbl...
> 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
>
>
>
Author
23 Jun 2006 3:25 PM
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

Show quote
"Markus Kling" <markus.kling@nospam.nospam> wrote in message
news:OUqqqQqlGHA.4512@TK2MSFTNGP04.phx.gbl...
> Vijay,
>
> you can find a good description on how to react and cancel system events
> at http://www.codeproject.com/csharp/systemeventshandler.asp.
>
> Markus
>
>
> "VJ" <vijayba***@yahoo.com> schrieb im Newsbeitrag
> news:e%23bw55jlGHA.4268@TK2MSFTNGP05.phx.gbl...
>> 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
>>
>>
>>
>
>
Author
23 Jun 2006 3:37 PM
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


Show quote
"VJ" <vijayba***@yahoo.com> schrieb im Newsbeitrag
news:OCzNOltlGHA.3924@TK2MSFTNGP05.phx.gbl...
> 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
>
> "Markus Kling" <markus.kling@nospam.nospam> wrote in message
> news:OUqqqQqlGHA.4512@TK2MSFTNGP04.phx.gbl...
>> Vijay,
>>
>> you can find a good description on how to react and cancel system events
>> at http://www.codeproject.com/csharp/systemeventshandler.asp.
>>
>> Markus
>>
>>
>> "VJ" <vijayba***@yahoo.com> schrieb im Newsbeitrag
>> news:e%23bw55jlGHA.4268@TK2MSFTNGP05.phx.gbl...
>>> 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
>>>
>>>
>>>
>>
>>
>
>

AddThis Social Bookmark Button