Presumably Session wraps the MSIHANDLE that you can't use from a deferred (non immediate) custom action. Whatever DTF offers in the way of CustomActionData is what you need for non-immediate custom actions.
Phil Wilson -----Original Message----- From: Peter Shirtcliffe [mailto:pshirtcli...@sdl.com] Sent: Tuesday, April 12, 2011 7:50 AM To: bharat jasti; General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Setup wizard ended prematurely because of an error I presume Session is a DTF thing but I don't use it. Sorry. From: bharat jasti [mailto:bharat.ja...@gmail.com] Sent: 12 April 2011 15:43 To: General discussion for Windows Installer XML toolset. Cc: Peter Shirtcliffe Subject: Re: [WiX-users] Setup wizard ended prematurely because of an error Hello Peter, I am getting the following error messages in verbose log Action 10:39:11: InstallFinalize. Action start 10:39:11: InstallFinalize. Action 10:39:11: myActionId. SFXCA: Extracting custom action to temporary directory: C:\WINDOWS\Installer\MSIB27.tmp-\ SFXCA: Binding to CLR version v4.0.30319 Calling custom action CustomAction2!CustomAction2.CustomActions.MySimpleAction Exception thrown by custom action: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Deployment.WindowsInstaller.InstallerException: Cannot access session details from a non-immediate custom action at Microsoft.Deployment.WindowsInstaller.Session.ValidateSessionAccess() at Microsoft.Deployment.WindowsInstaller.Session.set_Item(String property, String value) at CustomAction2.CustomActions.MySimpleAction(Session session) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture) at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(In t32 sessionHandle, String entryPoint, IntPtr remotingDelegatePtr) Action ended 10:39:11: InstallFinalize. Return value 3. Action 10:39:11: Rollback. Rolling back action: Rollback: myActionId Action ended 10:39:11: INSTALL. Return value 3. Action ended 10:39:11: ExecuteAction. Return value 3. Action 10:39:11: FatalError. Action start 10:39:11: FatalError. What do they mean? What session variables they refer to? Thanks & regards, Bharat Jasti Team IT Rainbow Design Services On Tue, Apr 12, 2011 at 10:21 AM, Peter Shirtcliffe <pshirtcli...@sdl.com> wrote: MsiProcessMessage() is probably what you're looking for. I don't know what the DTF equivalent is. http://msdn.microsoft.com/en-us/library/aa370354%28v=vs.85%29.aspx -----Original Message----- From: bharat jasti [mailto:bharat.ja...@gmail.com] Sent: 12 April 2011 14:29 To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Setup wizard ended prematurely because of an error Hello Uwe, Thanks for the info. This is my action script code: *public class CustomActions { [CustomAction] public static ActionResult MySimpleAction(Session session) { try { File.AppendAllText(@"c:\tmp\time.txt", ";Installation: " + DateTime.Now.ToString()); } catch (Exception) { return ActionResult.Failure; } return ActionResult.Success; } }*The above custom script is creating a text file under tmp folder. It works fine when tmp folder exists without error. But when I remove temp folder to check the error message to display, setup is ending prematurely. Following are my CustomAction and Install Sequence * <CustomAction Id="myActionId" BinaryKey="myAction" DllEntry="MySimpleAction" Execute="deferred" Return="check" /> <InstallExecuteSequence> <Custom Action="myActionId" After="InstallInitialize"></Custom> </InstallExecuteSequence>* Thanks & Regards, Bharat Jasti Team IT Rainbow Design Services On Tue, Apr 12, 2011 at 5:08 AM, Uwe Ernst <uwe.er...@gmail.com> wrote: > Hi Bharat, > > your CustomAction probably throws an uncatched exception. Methods > capable of throwing exceptions should be executed from within a > try-catch block. There you can show the user your own error message or > create the missing directory. My experience is, that exceptions are not > transported from the c# method to the installer runtime, so you always > have to take care of possible exceptions. > > > Regards Uwe > > Am 12.04.2011 00:02, schrieb bharatj: > > Hello All, > > > > I have written my first action script using C#. It has to create a text > > under temp folder. If temp folder exists action script runs successfully > and > > WIX MSI works perfect. If temp folder doesnt exist action script returns > > failure and Setup ends prematurely. It is not showing the intended > message > > like " Unable to create file ". > > > > ----------------------------------------------------------------------------- - > Forrester Wave Report - Recovery time is now measured in hours and minutes > not days. Key insights are discussed in the 2010 Forrester Wave Report as > part of an in-depth evaluation of disaster recovery service providers. > Forrester found the best-in-class provider in terms of services and vision. > Read this report now! http://p.sf.net/sfu/ibm-webcastpromo > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ----------------------------------------------------------------------------- - Forrester Wave Report - Recovery time is now measured in hours and minutes not days. Key insights are discussed in the 2010 Forrester Wave Report as part of an in-depth evaluation of disaster recovery service providers. Forrester found the best-in-class provider in terms of services and vision. Read this report now! http://p.sf.net/sfu/ibm-webcastpromo _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users SDL PLC confidential, all rights reserved. If you are not the intended recipient of this mail SDL requests and requires that you delete it without acting upon or copying any of its contents, and we further request that you advise us. SDL PLC is a public limited company registered in England and Wales. Registered number: 02675207. Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, UK. ----------------------------------------------------------------------------- - Forrester Wave Report - Recovery time is now measured in hours and minutes not days. Key insights are discussed in the 2010 Forrester Wave Report as part of an in-depth evaluation of disaster recovery service providers. Forrester found the best-in-class provider in terms of services and vision. Read this report now! http://p.sf.net/sfu/ibm-webcastpromo _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Forrester Wave Report - Recovery time is now measured in hours and minutes not days. Key insights are discussed in the 2010 Forrester Wave Report as part of an in-depth evaluation of disaster recovery service providers. Forrester found the best-in-class provider in terms of services and vision. Read this report now! http://p.sf.net/sfu/ibm-webcastpromo _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users *** Confidentiality Notice: This e-mail, including any associated or attached files, is intended solely for the individual or entity to which it is addressed. This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice of its status. Please notify the sender immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any other person. This email comes from a division of the Invensys Group, owned by Invensys plc, which is a company registered in England and Wales with its registered office at 3rd Floor, 40 Grosvenor Place, London, SW1X 7AW (Registered number 166023). For a list of European legal entities within the Invensys Group, please go to http://www.invensys.com/legal/default.asp?top_nav_id=77&nav_id=80&prev_id=77. You may contact Invensys plc on +44 (0)20 3155 1200 or e-mail recept...@invensys.com. This e-mail and any attachments thereto may be subject to the terms of any agreements between Invensys (and/or its subsidiaries and affiliates) and the recipient (and/or its subsidiaries and affiliates). ------------------------------------------------------------------------------ Forrester Wave Report - Recovery time is now measured in hours and minutes not days. Key insights are discussed in the 2010 Forrester Wave Report as part of an in-depth evaluation of disaster recovery service providers. Forrester found the best-in-class provider in terms of services and vision. Read this report now! http://p.sf.net/sfu/ibm-webcastpromo _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users