Wix DTF custom action is intermittently failing with Rundll32 error

851 views Asked by At

I have a WIX DTF custom action that is failing intermittently with a Rundll32 error:

SFXCA: RUNDLL32 returned error code: -1073740771

This is after the custom action has finished all its work successfully. I see a log entry indicating the method ran all the way to the end and returned success. This is near the end of the MSI, and 12 other managed custom actions have already executed. Nothing in the log indicates that the catch block was entered.

Could this be a bug in the DTF code? I'm using Wix toolset 3.11.0.1701 with Visual Studio 2017.

I looked up what "Note: 1: 2265" means, and apparently windows installer error 2265 is "Could not commit storage." I'm not sure what kind of storage this refers to.

Here is the custom action code (simplified and redacted):

[CustomAction]
public static ActionResult MyAction(Session session)
{
    ILogger logger = new Logger(session);
    string actionMethodName = MethodBase.GetCurrentMethod().Name;
    ActionResult customActionSuccess = ActionResult.Failure;

    try
    {
        logger.LogInfo("Begin {0} custom action", actionMethodName);

        Worker worker = new Worker();
        worker.DoWork();

        customActionSuccess = ActionResult.Success;
        logger.LogInfo("Exiting {0} custom action", actionMethodName);
    }
    catch (Exception ex)
    {
        string msg = string.Format("An error has occurred in {2}: {0}{0}{1}", Environment.NewLine, ex.ToString(), actionMethodName);
        logger.LogError(msg);
        throw;
    }

    return customActionSuccess;
}

Here's the relevant section of the windows installer log:

MSI (s) (D4:60) [11:43:39:783]: Executing op: ActionStart(Name=MyAction,,)
MSI (s) (D4:E4) [11:43:39:783]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSIFE04.tmp, Entrypoint: MyAction
SFXCA: Extracting custom action to temporary directory: C:\Users\user\AppData\Local\Temp\MSIFE04.tmp-\
SFXCA: Binding to CLR version v4.0.30319
Calling custom action CAAssembly.DTFCA!CAAssembly.DTFCA.CustomActions.MyAction

***** INFORMATION ***** Begin MyAction custom action
(Additional log entries here indicate custom action completed successfully)
***** INFORMATION ***** Exiting MyAction custom action

SFXCA: RUNDLL32 returned error code: -1073740771
CustomAction MyAction returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (D4:60) [11:47:29:028]: Note: 1: 2265 2:  3: -2147287035 
Action ended 11:47:28: InstallExecute. Return value 3.
0

There are 0 answers