The same error occurs if the custom type is set to 1 or 1025 (deferred).
According to the MSI SDK, ProductCode is one of the few properties
available during a deferred custom action.

Try the code yourself 

[CustomAction]
public static ActionResult CATest(Session session)
{
            
        session.Log("Begin CATest");
      
        string sProductCode = session.GetProductProperty("ProductCode");
        
        session.Log("sProductCode = " + sProductCode );
        
        return ActionResult.Success;
}


Thanks

Simon

-----Original Message-----
From: Brian Rogers [mailto:[EMAIL PROTECTED] 
Sent: 11 November 2008 22:38
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] GetProductProperty "The Handle is invalid"
error

My guess is that you are running a deferred custom action, and thus have
minimal access to the data in the installer database.  Did you really
want a product property or do you actually need a session property?

######################################
$_='^#(/||/@[EMAIL PROTECTED]@:^[-['^";@@@\\>])@.".
"{)/];)^{";$,+=(++$,);$_.=">&$,";`$_`;


-----Original Message-----
From: Powell, Simon [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 11, 2008 1:31 PM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] GetProductProperty "The Handle is invalid" error

Hi,

Both a colleague and I are having the same error calling
GetProductProperty from a Managed custom action. Is this a know issue?
If not, what is the correct usage?

We both use Visual Studio 2008 and the latest version of the WIX3 build
(v3.0.4624.0). Below is a snippet from the log :

Action 15:37:53: TestCA.
Action start 15:37:53: TestCA.
SFXCA: Extracting custom action to temporary directory:
C:\WINDOWS\Installer\MSIF3F.tmp-\
SFXCA: Binding to CLR version v2.0.50727 Calling custom action
CustomAction1!CustomAction1.CustomActions.CustomAction1
Begin CustomAction1
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
Microsoft.Deployment.WindowsInstaller.InvalidHandleException: The handle
is invalid.
   at
Microsoft.Deployment.WindowsInstaller.Session.GetProductProperty(String
property)
   at CustomAction1.CustomActions.CustomAction1(Session session)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object
arguments, SignatureStruct& sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object
arguments, Signature sig, MethodAttributes methodAttributes,
RuntimeTypeHandle 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.InvokeCustomActi
on(Int32 sessionHandle, String entryPoint, IntPtr remotingDelegatePtr)
Action ended 15:37:54: TestCA. Return value 3.

Any help would be much appreciated.

Thank you
Simon


--
This e-mail is confidential and the information contained in it may be
privileged.  It should not be read, copied or used by anyone other than
the intended recipient.  If you have received it in error, please
contact the sender immediately by telephoning +44 (0)20 7623 8000 or by
return email, and delete the e-mail and do not disclose its contents to
any person.  We believe, but do not warrant, that this e-mail and any
attachments are virus free, but you must take full responsibility for
virus checking.  Please refer to
http://www.dresdnerkleinwort.com/disc/email/ and read our e-mail
disclaimer statement and monitoring policy.

Dresdner Kleinwort is the trading name of the investment banking
division of Dresdner Bank AG, and operates through Dresdner Bank AG,
Dresdner Kleinwort Limited and their affiliated or associated companies.
Dresdner Bank AG is a company incorporated in Germany with limited
liability and registered in England (registered no. FC007638, place of
business 30 Gresham Street, London EC2V 7PG), and is authorised by the
German Federal Financial Supervisory Authority and authorised and
subject to limited regulation by the Financial Services Authority
("FSA"). Details about the extent of our authorisation and regulation by
the FSA are available from us on request.  Dresdner Kleinwort Limited is
a company incorporated in England (registered no. 551334, registered
office 30 Gresham Street, London EC2V 7PG), and is authorised and
regulated by the FSA.
--

------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge Build the coolest Linux based applications with Moblin SDK &
win great prizes Grand prize is a trip for two to an Open Source event
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge Build the coolest Linux based applications with Moblin SDK &
win great prizes Grand prize is a trip for two to an Open Source event
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


--
This e-mail is confidential and the information contained in it may be 
privileged.  It should not be read, copied or used by anyone other than the 
intended recipient.  If you have received it in error, please contact the 
sender immediately by telephoning +44 (0)20 7623 8000 or by return email, and 
delete the e-mail and do not disclose its contents to any person.  We believe, 
but do not warrant, that this e-mail and any attachments are virus free, but 
you must take full responsibility for virus checking.  Please refer to 
http://www.dresdnerkleinwort.com/disc/email/ and read our e-mail disclaimer 
statement and monitoring policy.

Dresdner Kleinwort is the trading name of the investment banking division of 
Dresdner Bank AG, and operates through Dresdner Bank AG, Dresdner Kleinwort 
Limited and their affiliated or associated companies. Dresdner Bank AG is a 
company incorporated in Germany with limited liability and registered in 
England (registered no. FC007638, place of business 30 Gresham Street, London 
EC2V 7PG), and is authorised by the German Federal Financial Supervisory 
Authority and authorised and subject to limited regulation by the Financial 
Services Authority ("FSA"). Details about the extent of our authorisation and 
regulation by the FSA are available from us on request.  Dresdner Kleinwort 
Limited is a company incorporated in England (registered no. 551334, registered 
office 30 Gresham Street, London EC2V 7PG), and is authorised and regulated by 
the FSA. 
--


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to