I have a visual studio 2008 install project with a custom action for install and commit. It works fine on 9 PCs but on the 10th it fails with an unknown error. I have posted the code for the install and commit event handlers and the part of the msi log where the error occurred.
I have been able to determine that the install event gets control and processes without going into the catch block and so no obvious errors seem to be happening in the code butas soon as the install event is done and passes control back to whoever called it the Unknown Error occurs.
Custom Action Code
-Note-
The CustomActionData Property for the Install and Commit event has the following definition
/ltyTargetDir="[TARGETDIR]\"
public override void Commit(System.Collections.IDictionary savedState)
{
try
{
base.Commit(savedState);
// Launch USBSetup exe which will put the inf driver into the store
String args = @"""" + @savedState["TargetDir"].ToString() + INFFILENAME + @"""";
Process.Start(@"""" + @savedState["TargetDir"].ToString() + EXEFILENAME + @"""", args);
}
catch (Exception ex)
{
...
}
}
-Note-
I have been able to step through the following code and produce no errors or anything else that might be helpful
public override void Install(System.Collections.IDictionary stateSaver)
{
try
{
base.Install(stateSaver);
//Save the inf file location in the 'global' dictionary to be used by commit
stateSaver.Add("TargetDir", Context.Parameters["ltyTargetDir"].ToString());
}
catch (Exception ex)
{
....
}
}
Section of an MSI log for the error case
MSI (s) (78:4C) [20:21:02:982]: Executing op: ActionStart(Name=_D8C363A4_4858_496B_94FE_84D5579AC227.install,,)
Action 20:21:02: _D8C363A4_4858_496B_94FE_84D5579AC227.install.
MSI (s) (78:4C) [20:21:02:982]: Executing op: CustomActionSchedule(Action=_D8C363A4_4858_496B_94FE_84D5579AC227.install,ActionType=3073,Source=BinaryData,Target=ManagedInstall,CustomActionData=/installtype=notransaction /action=install /LogFile= /ltyTargetDir="C:\Program Files\Thales Communications\Thales Liberty PcProgrammer\\" "C:\Program Files\Thales Communications\Thales Liberty PcProgrammer\ltyPostInstallClass.dll" "C:\DOCUME~1\wmotter\LOCALS~1\Temp\CFG29DC.tmp")
MSI (s) (78:14) [20:21:02:997]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI29E0.tmp, Entrypoint: ManagedInstall
MSI (s) (78:40) [20:21:02:997]: Generating random cookie.
MSI (s) (78:40) [20:21:03:029]: Created Custom Action Server with PID 212 (0xD4).
MSI (s) (78:1C) [20:21:04:185]: Running as a service.
MSI (s) (78:1C) [20:21:04:185]: Hello, I'm your 32bit Elevated custom action server.
DEBUG: Error 2835: The control ErrorIcon was not found on dialog ErrorDialog
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2835. The arguments are: ErrorIcon, ErrorDialog,
Error 1001. Error 1001. Unknown error "-1".
MSI (s) (78!00) [20:21:18:513]:
MSI (s) (78:14) [20:21:18:513]: Leaked MSIHANDLE (91) of type 790531 for thread 1280
MSI (s) (78:14) [20:21:18:513]: Note: 1: 2769 2: _D8C363A4_4858_496B_94FE_84D5579AC227.install 3: 1
DEBUG: Error 2769: Custom Action _D8C363A4_4858_496B_94FE_84D5579AC227.install did not close 1 MSIHANDLEs.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2769. The arguments are: _D8C363A4_4858_496B_94FE_84D5579AC227.install, 1,
Action ended 20:21:18: InstallExecute. Return value 3.