[wix-users] Debug custom action in VS2017

Blair Murri osito at live.com
Tue Jan 29 09:17:15 PST 2019


I gave a generalized answer that has in the past helped most people with that type of issue.

It appears that your CA is running "as user", the environment variables are required for cases where the message box would appear in a different desktop (which sometimes requires rebooting to recover) or when using DTF (C#) CAs. The relevant vars are MsiBreak and MMsiBreak.

Access denied is usually a result of the debugger not being elevated, thus not having access to connect to the CA sandbox process (msiexec.exe).

I haven't yet personally tried debugging a CA with VS 2017 (no need so far) so I don't know what may have changed from previous versions of VS. It might be useful to ask the VS team for troubleshooting steps.

Get Outlook for Android<https://aka.ms/ghei36>

________________________________
From: Lmloge <lmloge at orange.fr>
Sent: Monday, January 28, 2019 2:05:18 AM
To: wix-users at lists.wixtoolset.org
Cc: Blair Murri
Subject: Re: [wix-users] Debug custom action in VS2017

Hello and thank you for your answer.

> Your debugger must be running elevated (as an administrator).

The debugger is running elevated (as an administrator).

> especially when debugging deferred CAs

The custom action is not deferred.

> CAs that don't "run as user"

I am not sure how the custom action is run.
Given my original post, it looks like it is run as <hostname>\<username>:

  In Visual Studio 2017, when I select the menu "Debug -> Attach to process...".
  I can see the following entry in the "Available processes" list :
  Process : msiexec.exe
  Title   : (Custom action) Debug
  Type    : x86
  Username: <hostname>\<username>
  Session : 9
  where:
  <hostname> is my machine name.
  <username> is my system user name.

> Using MessageBox doesn't always work

What do you mean?
The message box actually appears.

> the environment variables involved need to be set per-machine

What environment variables are you talking about?

Best regards.
--
Léa
My time: https://www.horlogeparlante.com/heure-brest-france-HEUREfrance3030300.htm


On 25/01/2019 7:22 PM, Blair Murri wrote:
Your debugger must be running elevated (as an administrator).

Using MessageBox doesn't always work (especially when debugging deferred CAs that don't "run as user". MSFT provides instructions, but the environment variables involved need to be set per-machine and it's recommended to reboot after setting them to ensure that they will be found by all the system services that need to see them

--
Blair Murri





________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org><mailto:wix-users-bounces at lists.wixtoolset.org> on behalf of Lmloge via wix-users <wix-users at lists.wixtoolset.org><mailto:wix-users at lists.wixtoolset.org>
Sent: Friday, January 25, 2019 2:19:24 AM
To: wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>
Cc: Lmloge
Subject: [wix-users] Debug custom action in VS2017

Hello,

After building a setup file
and while trying to install an application by running this setup file
something wrong is happening while executing a custom action.

To find out what's going wrong, I need to debug the code which is C/C++
code in Microsoft Visual Studio 2017.

To do that, I've put a "MessageBox()" function call in the custom action
code:
MessageBox(NULL, L"*** (Custom action) Please attach a debugger. ***",
L"(Custom action) Debug", MB_OK);

When I start the installation, the message box pops up.

In Visual Studio 2017, I select the menu "Debug -> Attach to process...".
I select the entry in the "Available processes" list :
------------+-----+--------------------------+------+-----------------------+-----------
Process     | ... | Title                    | Type | User
name             | Session
------------+-----+--------------------------+------+-----------------------+-----------
msiexec.exe | ... | (Custom action) Debug    | x86  |
<hostname>\<username> | 9
------------+-----+--------------------------+------+-----------------------+-----------
and click "Attach".
<hostname> is my machine name.
<username> is my system user name.

I get the error message:
"Unable to attach to process. Access is denied."

I have tried to make it work with no success.

Can you advise me what to do to be able to debug my custom action code?

Thank you.
Best regards
--
Léa





More information about the wix-users mailing list