|OutOfMemoryException||Out of memory or other system resources.|
|SystemException||Unexpected VSS system error. The error code is logged in the event log.|
|VssBadStateException||The backup components object is not initialized, this method has been called during a restore operation, or this method has not been called within the correct sequence.|
For a typical backup operation, SaveAsXml should not be called until after both writers and the requester are finished modifying the Backup Components Document.
Writers can continue to modify the Backup Components Document until their successful return from handling the PostSnapshot event (CVssWriter::OnPostSnapshot), or equivalently upon the completion of DoSnapshotSet.
Requesters will need to continue to modify the Backup Components Document as the backup progresses. In particular, a requester will store a component-by-component record of the success or failure of the backup through calls to the SetBackupSucceeded(Guid, Guid, VssComponentType, String, String, Boolean) method.
Once the requester has finished modifying the Backup Components Document, the requester should useto save a copy of the document to the backup media.
A Backup Components Document can be saved at earlier points in the life cycle of a backup operation, for instance, to support the generation of transportable shadow copies to be handled on remote machines.
However, PrepareForBackup, because the Backup Components Document will not have been filled by the requester and the writers.should never be called prior to