Thanks for the ideas Steve. I tried running my code in a separate thread, like yours, but it still hangs. I'm running on Windows Vista Business 32-bit. I noticed, by accident, that in Process Explorer when the custom action starts up that a new process tree is spawned:
1. msiexec.exe 2. msiexec.exe 3. rundll.exe (DTF Self-Extracting Custom Action) The custom action is run when I click the next button on the ServiceOptionsDlg in my installer. The 1st time I click the button it hangs. If I kill the process tree above and click the next button again, it runs my custom action. Every time after that, if I click "next", my custom action works fine. I'm baffled why. Here's the log from me, killing the process tree the 1st time (the one at 11:11:06:126), then running my custom action (Directory.Exists()) on a path of "t" and then on a path of "C:\": Action 11:08:53: ServiceOptionsDlg. Dialog created MSI (c) (CC:24) [11:08:58:414]: PROPERTY CHANGE: Adding ARCHIVE_PATH property. Its value is 't'. MSI (c) (CC:24) [11:08:58:543]: PROPERTY CHANGE: Adding _DirectoryExists_Path property. Its value is 't'. MSI (c) (CC:24) [11:08:58:543]: Doing action: CheckArchiveDirectory Action 11:08:58: CheckArchiveDirectory. Action start 11:08:58: CheckArchiveDirectory. MSI (c) (CC:80) [11:08:58:573]: Invoking remote custom action. DLL: C:\Users\e25735\AppData\Local\Temp\MSIF23D.tmp, Entrypoint: DirectoryExists MSI (c) (CC:A8) [11:08:58:574]: Cloaking enabled. MSI (c) (CC:A8) [11:08:58:574]: Attempting to enable all disabled privileges before calling Install on Server MSI (c) (CC:A8) [11:08:58:575]: Connected to service for CA interface. Action ended 11:11:02: CheckArchiveDirectory. Return value 1. MSI (c) (CC:24) [11:11:06:126]: Doing action: CheckArchiveDirectory Action 11:11:06: CheckArchiveDirectory. Action start 11:11:06: CheckArchiveDirectory. MSI (c) (CC:A0) [11:11:06:184]: Invoking remote custom action. DLL: C:\Users\e25735\AppData\Local\Temp\MSIE4A7.tmp, Entrypoint: DirectoryExists MSI (c) (CC:A0) [11:11:06:184]: Lost connection to custom action server process. Attempting to regenerate. MSI (c) (CC:A8) [11:11:06:259]: Cloaking enabled. MSI (c) (CC:A8) [11:11:06:259]: Attempting to enable all disabled privileges before calling Install on Server MSI (c) (CC:A8) [11:11:06:259]: Connected to service for CA interface. MSI (c) (CC!8C) [11:11:31:366]: PROPERTY CHANGE: Adding _DirectoryExists_Result property. Its value is 'no'. Action ended 11:11:47: CheckArchiveDirectory. Return value 1. MSI (c) (CC:24) [11:11:47:571]: PROPERTY CHANGE: Adding VErr_Text property. Its value is 'The archive path specified does not exist.'. Action 11:11:47: ValidationErrDlg. Dialog created MSI (c) (CC:24) [11:11:57:555]: PROPERTY CHANGE: Modifying ARCHIVE_PATH property. Its current value is 't'. Its new value: 'c:\'. MSI (c) (CC:24) [11:11:57:731]: PROPERTY CHANGE: Modifying _DirectoryExists_Path property. Its current value is 't'. Its new value: 'c:\'. MSI (c) (CC:24) [11:11:57:731]: Doing action: CheckArchiveDirectory Action 11:11:57: CheckArchiveDirectory. Action start 11:11:57: CheckArchiveDirectory. MSI (c) (CC:14) [11:11:57:745]: Invoking remote custom action. DLL: C:\Users\e25735\AppData\Local\Temp\MSIAE3D.tmp, Entrypoint: DirectoryExists MSI (c) (CC!E8) [11:12:05:774]: PROPERTY CHANGE: Modifying _DirectoryExists_Result property. Its current value is 'no'. Its new value: 'yes'. Action ended 11:12:06: CheckArchiveDirectory. Return value 1. Action 11:12:06: VerifyReadyDlg. Dialog created It appears that the 1st time my custom action runs, it's hanging before it even gets to my code. I've tried putting MessageBox and System.Diagnosics.Debugger.Launch() as the 1st line of code in my custom action. They never get called. I also tried this on our SIT Windows 2003 server. The custom action runs without hanging. Here is the log: Action 11:44:17: ServiceOptionsDlg. Dialog created MSI (c) (68:74) [11:44:20:682]: PROPERTY CHANGE: Adding ARCHIVE_PATH property. Its value is 't'. MSI (c) (68:74) [11:44:20:854]: PROPERTY CHANGE: Adding _DirectoryExists_Path property. Its value is 't'. MSI (c) (68:74) [11:44:20:854]: Doing action: CheckArchiveDirectory Action 11:44:20: CheckArchiveDirectory. Action start 11:44:20: CheckArchiveDirectory. MSI (c) (68:1C) [11:44:21:651]: Invoking remote custom action. DLL: C:\DOCUME~1\e25735\LOCALS~1\Temp\1\MSI2.tmp, Entrypoint: DirectoryExists MSI (c) (68:AC) [11:44:21:667]: Cloaking enabled. MSI (c) (68:AC) [11:44:21:667]: Attempting to enable all disabled priveleges before calling Install on Server MSI (c) (68:AC) [11:44:21:667]: Connected to service for CA interface. MSI (c) (68!68) [11:44:22:745]: PROPERTY CHANGE: Adding _DirectoryExists_Result property. Its value is 'no'. Action ended 11:44:22: CheckArchiveDirectory. Return value 1. MSI (c) (68:74) [11:44:22:901]: PROPERTY CHANGE: Adding VErr_Text property. Its value is 'The archive path specified does not exist.'. Action 11:44:22: ValidationErrDlg. Dialog created MSI (c) (68:74) [11:44:29:480]: PROPERTY CHANGE: Modifying ARCHIVE_PATH property. Its current value is 't'. Its new value: 'c:\'. MSI (c) (68:74) [11:44:29:637]: PROPERTY CHANGE: Modifying _DirectoryExists_Path property. Its current value is 't'. Its new value: 'c:\'. MSI (c) (68:74) [11:44:29:637]: Doing action: CheckArchiveDirectory Action 11:44:29: CheckArchiveDirectory. Action start 11:44:29: CheckArchiveDirectory. MSI (c) (68:00) [11:44:29:668]: Invoking remote custom action. DLL: C:\DOCUME~1\e25735\LOCALS~1\Temp\1\MSI3.tmp, Entrypoint: DirectoryExists MSI (c) (68!00) [11:44:30:387]: PROPERTY CHANGE: Modifying _DirectoryExists_Result property. Its current value is 'no'. Its new value: 'yes'. Action ended 11:44:30: CheckArchiveDirectory. Return value 1. Action 11:44:30: VerifyReadyDlg. Dialog created Anyone have any ideas what would be causing the hang? It was thinking it might be permissions or a group policy setting but then running the custom action should fail every time. Thank, Chris McKinnon -----Original Message----- From: Steve Green [mailto:sgr...@gtl.biz] Sent: Monday, October 18, 2010 2:38 AM To: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] Calling a managed custom action from a UI control Chris, I had a similar problem opening the windows OpenFileDialog common dialog. I found it would work fine on Windows Server 2003 but on Windows 7 it just hung, showing the same spinning wheel. I ended up having to open the dialog in a new thread, then all worked fine. My C# code was as follows: public class ShowOpenFileDlg { private OpenFileDialog _dlg; private Session _session; public ShowOpenFileDlg(Session session) { _session = session; _dlg = new OpenFileDialog(); } public void Show() { if (_dlg.ShowDialog() == DialogResult.OK) { _session["BROWSEFILE"] = _dlg.FileName; } } } [CustomAction] public static ActionResult ShowFileOpenDlg(Session session) { ShowOpenFileDlg dlg = new ShowOpenFileDlg(session); Thread thread = new Thread(dlg.Show); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); return ActionResult.Success; } As for debugging, I had the same problem with the log file so ended up just adding MessageBox.Show(...) lines through my code. Hope this helps. Steve McKinnon Chris wrote: > > Hi, > > I have built a managed custom action to check if a UNC path exists. I'm > not installing to this path. This path is simply being set as the value > of a .config file setting during the install. I just want to verify > that it is a valid path. The custom action is defined as follows: > > [CustomAction] > public static ActionResult DirectoryExists(Session session) > { > CustomActionService service = new CustomActionService(); > return service.DirectoryExists(session); > } > > I created the custom action project using the Visual Studio template for > a C# custom action. This custom action expects a > "_DirectoryExists_Path" property to contain the path to check. And it > populates a "_DirectoryExists_Result" with a "yes" (true) or "no" > (false) result. The custom action is just calling > System.IO.Directory.Exists() to do the check. I have the custom action > defined in the installer like so: > > <CustomAction Id="CheckArchiveDirectory" > BinaryKey="AppDevInstallCustomActions.dll" DllEntry="DirectoryExists" > Execute="immediate" Return="ignore" Impersonate="yes" /> > > And to be called in the UI, like so: > > <Publish Dialog="ServiceOptionsDlg" Control="Back" Event="NewDialog" > Value="ServiceCredentialsDlg">1</Publish> > <Publish Dialog="ServiceOptionsDlg" Control="Next" > Property="_DirectoryExists_Path" Value="[ARCHIVE_PATH]" > Order="1">1</Publish> > <Publish Dialog="ServiceOptionsDlg" Control="Next" Event="DoAction" > Value="CheckArchiveDirectory" Order="2">1</Publish> > <Publish Dialog="ServiceOptionsDlg" Control="Next" Property="VErr_Text" > Value="The archive path specified does not exist." > Order="3"><![CDATA[_DirectoryExists_Result = "no"]]></Publish> > <Publish Dialog="ServiceOptionsDlg" Control="Next" Event="SpawnDialog" > Value="ValidationErrDlg" Order="4"><![CDATA[_DirectoryExists_Result = > "no"]]></Publish> > <Publish Dialog="ServiceOptionsDlg" Control="Next" Event="NewDialog" > Value="VerifyReadyDlg" Order="5"><![CDATA[_DirectoryExists_Result = > "yes"]]></Publish> > > When run to the installer and click the "Next" button, I get the > spinning blue wheel of death. I've tried adding a > "System.Diagnostics.Debugger.Launch();" line to the above code but the > debugger is never launched. If I run a verbose log, it just ends at the > line before the custom action call. Here's the last 5 lines: > > Action 10:41:55: ServiceOptionsDlg. Dialog created > MSI (c) (20:44) [10:41:57:524]: Doing action: CheckArchiveDirectory > Action 10:41:57: CheckArchiveDirectory. > Action start 10:41:57: CheckArchiveDirectory. > MSI (c) (20:6C) [10:41:57:541]: Invoking remote custom action. DLL: > > I'm stumped. Any ideas or tips for debugging this would be > appreciated. I'm also encrypting (and decrypting) my .config files > using this same managed custom action dll, so I know the DLL is > partially working. These custom actions are scheduled in the > InstallExecuteSequence after "InstallFinalize", however. > > Thanks, > > Chris McKinnon > > > > The information contained in this e-mail is confidential and may contain > privileged information. It is intended only for the person or persons > named above. If you are not an intended recipient of this e-mail please be > advised that any distribution or copying of this e-mail is prohibited. If > you have received this e-mail in error, please notify us by return e-mail > and delete all copies of the e-mail and any attachments. > ------------------------------------------------------------------------ ------ > Download new Adobe(R) Flash(R) Builder(TM) 4 > The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly > Flex(R) Builder(TM)) enable the development of rich applications that run > across multiple browsers and platforms. Download your free trials today! > http://p.sf.net/sfu/adobe-dev2dev > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > -- View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Calling-a- managed-custom-action-from-a-UI-control-tp5639681p5646237.html Sent from the wix-users mailing list archive at Nabble.com. ------------------------------------------------------------------------ ------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users The information contained in this e-mail is confidential and may contain privileged information. It is intended only for the person or persons named above. If you are not an intended recipient of this e-mail please be advised that any distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify us by return e-mail and delete all copies of the e-mail and any attachments. ------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users