Reputation: 51
In custom action I override following function and got exception in rollback case...
"savedState dictionary does not contain the expected values and might have been corrupted. "
Is there any other way to rollback ?
protected override void OnBeforeInstall(System.Collections.IDictionary savedState)
{
try
{
bool report = false; //Some validation
if (!report)
throw new InstallException("License is not valid.");
base.OnBeforeInstall(savedState);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
base.Rollback(savedState);
}
}
Upvotes: 3
Views: 2029
Reputation: 11
You can use pinvoke to call the cancel button on the base installer. This will rollback without any installexception error message dialogs.
Upvotes: 1
Reputation: 35477
Change "base.Rollback()" in the exception handler to "throw;". Your caller will call Rollback at the correct time.
Upvotes: 1