.NET Framework Class Library
Installer..::.Rollback Method

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

Namespace:  System.Configuration.Install
Assembly:  System.Configuration.Install (in System.Configuration.Install.dll)
Syntax

Visual Basic (Declaration)
Public Overridable Sub Rollback ( _
    savedState As IDictionary _
)
Visual Basic (Usage)
Dim instance As Installer
Dim savedState As IDictionary

instance.Rollback(savedState)
C#
public virtual void Rollback(
    IDictionary savedState
)
Visual C++
public:
virtual void Rollback(
    IDictionary^ savedState
)
JScript
public function Rollback(
    savedState : IDictionary
)

Parameters

savedState
Type: System.Collections..::.IDictionary
An IDictionary that contains the pre-installation state of the computer.
Exceptions

ExceptionCondition
ArgumentException

The savedState parameter is nullNothingnullptra null reference (Nothing in Visual Basic).

-or-

The saved-state IDictionary might have been corrupted.

InstallException

An exception occurred during the Rollback 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.

Remarks

Notes to Inheritors:

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

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.

Visual Basic
' 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 'Rollback
C#
// 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" );
}
Visual C++
   // 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" );
   }
.NET Framework Security

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
See Also

Reference

Tags :


Page view tracker