Redigera

Dela via


Installer.Rollback(IDictionary) Method

Definition

When overridden in a derived class, restores the pre-installation state of the computer.

public:
 virtual void Rollback(System::Collections::IDictionary ^ savedState);
public virtual void Rollback (System.Collections.IDictionary savedState);
abstract member Rollback : System.Collections.IDictionary -> unit
override this.Rollback : System.Collections.IDictionary -> unit
Public Overridable Sub Rollback (savedState As IDictionary)

Parameters

savedState
IDictionary

An IDictionary that contains the pre-installation state of the computer.

Exceptions

The savedState parameter is null.

-or-

The saved-state IDictionary might have been corrupted.

An exception occurred during the Rollback(IDictionary) phase of the installation. This exception is ignored and the rollback continues. However, the computer might not be fully reverted to its initial state after the rollback completes.

Examples

The following example demonstrates the Rollback method of Installer. The Rollback method is overridden in the derived class of Installer. An exception is generated to force an installation rollback.

   // Override 'Rollback' method of Installer class.
public:
   virtual void Rollback( IDictionary^ mySavedState ) override
   {
      Installer::Rollback( mySavedState );
      Console::WriteLine( "The Rollback method of 'MyInstallerSample'" +
                         " has been called" );
   }
// Override 'Rollback' method of Installer class.
public override void Rollback( IDictionary mySavedState )
{
   base.Rollback( mySavedState );
   Console.WriteLine( "The Rollback method of 'MyInstallerSample'" +
                     " has been called" );
}
' Override 'Rollback' method of Installer class.
Public Overrides Sub Rollback(mySavedState As IDictionary)
   MyBase.Rollback(mySavedState)
   Console.WriteLine("The Rollback method of 'MyInstallerSample'" + _
                                                " has been called")
End Sub

Notes to Inheritors

When you override the Rollback(IDictionary) method in a derived class, be sure to call the base class's Rollback(IDictionary) method first in your derived method. A rollback operation restores the computer to the state it was in before the installations occurred. The Rollback(IDictionary) method is called if the Install(IDictionary) method of this instance of Installer, or any installer in the installer collection, fail to run correctly. Any exceptions generated by calling the Rollback(IDictionary) methods of the installers in the installer collection are ignored and the rollback of the other installers continues.

Applies to

See also