Discussion:
[WiX-users] Problem with DTF Custom action invoked via PushButton Event : DoAction
Krishna Nadiminti
2008-06-08 15:37:57 UTC
Permalink
Hi Jason,

I've created a few custom actions in C# using your wonderful DTF framework.

So far, I found a couple of issues. One of them seems to be a showstopper -
for now.

1. I invoke my C# custom action when a PushButton raises the DoAction
control event. The action gets called correctly, (most of the time about 80%
of the time) and while it seems to do the right thing, I don't get any of
the messages I logged from inside my custom action using session.Log. My
other custom actions which are directly sequenced in the
InstallExecuteSequence do log messages out, and those messages appear
correctly.

2. This is the 80% part. I read a previous post from someone, who said a
similar thing, and your reply saying it was fixed. I'm currently using Wix
v.3.0.4207. But, in my case occasionally it just doesn't work. No error
messages are shown in the log - nothing. Just says my CA died and that's it.
Now, if I rebuild, and re-launch the setup, it generally works. I'm using VS
2008 and Votive by the way, to build stuff. My CA method has a try/catch
that surrounds all the code, to catch any exception, log it to the session
and return ActionResult.Failure.

3. Now, this may be helpful to developers in the future: how about packaging
the .pdb file of the .NET custom action dll along with the dll and
MS.Deployment.dll? This would give people slightly better info regarding the
line number etc where their .NET CA code fails.

4. Another one, related to 3, is the build process for the PackCustomAction
MSBuild target (in the MakeSFX)... My custom action that runs in immediate
mode, during the UI sequence and does not modify the system, shows a
Winforms dialog. I have to show a list of x509 certs to the user to select
one, and Wix UI is simply incapable of doing that. (I really dont want to
hack up the listView control and stuff in Wix/MSI's standard UI - it just
doesn't serve my purpose). Anyway, this Winforms thing actually works but I
had a couple of issues along the way : The MakeSfxCA step after my custom
action compilation complains about System.Windows.Forms not being in my
bin\Debug directory. If I set System.Windows.Forms.dll, and its dependencies
to be copied locally, in VS 2008, then MakeSFX does not complain - otherwise
- it blows up.
I looked into the code to see what it is doing - and understand where and
why it blows up: it tries to load the Assembly dependencies from the
bin\Debug directory (or whereever the .NET CA compiles to), and can't find
it! Now, I think there should be some code in there to avoid checking for
Exported types, and methods decorated with [CustomAction], IF the dependency
is a standard .NET Fx dll or perhaps you could check if the dll is GAC-ed.
Both of these first require to not assume that all the dependencies are in
the bin\Debug directory.

I hope that makes sense. Please let me know what you think.

Thanks,
Krishna.
--
View this message in context: http://www.nabble.com/Problem-with-DTF-Custom-action-invoked-via-PushButton-Event-%3A-DoAction-tp17719937p17719937.html
Sent from the wix-users mailing list archive at Nabble.com.
Christopher Painter
2008-06-08 16:17:59 UTC
Permalink
This is  known issue with Windows Installer, not DTF.    The context/handle is different from within  DoAction ControlEvent rather then  sequenced CA.    MsiProcessMessage calls won't work.


Christopher Painter, Author of Deployment Engineering Blog
Have a hot tip, know a secret or read a really good thread that deserves attention? E-Mail Me

--- On Sun, 6/8/08, Krishna Nadiminti <***@hotmail.com> wrote:

From: Krishna Nadiminti <***@hotmail.com>
Subject: [WiX-users] Problem with DTF Custom action invoked via PushButton Event : DoAction
To: wix-***@lists.sourceforge.net
Date: Sunday, June 8, 2008, 10:37 AM

Hi Jason,

I've created a few custom actions in C# using your wonderful DTF framework.

So far, I found a couple of issues. One of them seems to be a showstopper -
for now.

1. I invoke my C# custom action when a PushButton raises the DoAction
control event. The action gets called correctly, (most of the time about 80%
of the time) and while it seems to do the right thing, I don't get any of
the messages I logged from inside my custom action using session.Log. My
other custom actions which are directly sequenced in the
InstallExecuteSequence do log messages out, and those messages appear
correctly.

2. This is the 80% part. I read a previous post from someone, who said a
similar thing, and your reply saying it was fixed. I'm currently using Wix
v.3.0.4207. But, in my case occasionally it just doesn't work. No error
messages are shown in the log - nothing. Just says my CA died and that's
it.
Now, if I rebuild, and re-launch the setup, it generally works. I'm using
VS
2008 and Votive by the way, to build stuff. My CA method has a try/catch
that surrounds all the code, to catch any exception, log it to the session
and return ActionResult.Failure.

3. Now, this may be helpful to developers in the future: how about packaging
the .pdb file of the .NET custom action dll along with the dll and
MS.Deployment.dll? This would give people slightly better info regarding the
line number etc where their .NET CA code fails.

4. Another one, related to 3, is the build process for the PackCustomAction
MSBuild target (in the MakeSFX)... My custom action that runs in immediate
mode, during the UI sequence and does not modify the system, shows a
Winforms dialog. I have to show a list of x509 certs to the user to select
one, and Wix UI is simply incapable of doing that. (I really dont want to
hack up the listView control and stuff in Wix/MSI's standard UI - it just
doesn't serve my purpose). Anyway, this Winforms thing actually works but I
had a couple of issues along the way : The MakeSfxCA step after my custom
action compilation complains about System.Windows.Forms not being in my
bin\Debug directory. If I set System.Windows.Forms.dll, and its
dependencies
to be copied locally, in VS 2008, then MakeSFX does not complain - otherwise
- it blows up.
I looked into the code to see what it is doing - and understand where and
why it blows up: it tries to load the Assembly dependencies from the
bin\Debug directory (or whereever the .NET CA compiles to), and can't
find
it! Now, I think there should be some code in there to avoid checking for
Exported types, and methods decorated with [CustomAction], IF the dependency
is a standard .NET Fx dll or perhaps you could check if the dll is GAC-ed.
Both of these first require to not assume that all the dependencies are in
the bin\Debug directory.

I hope that makes sense. Please let me know what you think.

Thanks,
Krishna.
--
View this message in context:
http://www.nabble.com/Problem-with-DTF-Custom-action-invoked-via-PushButton-Event-%3A-DoAction-tp17719937p17719937.html
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Krishna Nadiminti
2008-06-09 01:44:04 UTC
Permalink
Thanks Chris!

So is there no known way to log messages from a custom action invoked via
PushButton-DoAction event?

Krishna
Post by Christopher Painter
This is  known issue with Windows Installer, not
DTF.    The context/handle is different from within 
DoAction ControlEvent rather then  sequenced CA.   
MsiProcessMessage calls won't work.
Christopher Painter, Author of Deployment Engineering Blog
Have a hot tip, know a secret or read a really good thread that deserves
attention? E-Mail Me
Subject: [WiX-users] Problem with DTF Custom action invoked via PushButton Event : DoAction
Date: Sunday, June 8, 2008, 10:37 AM
Hi Jason,
I've created a few custom actions in C# using your wonderful DTF framework.
So far, I found a couple of issues. One of them seems to be a showstopper -
for now.
1. I invoke my C# custom action when a PushButton raises the DoAction
control event. The action gets called correctly, (most of the time about 80%
of the time) and while it seems to do the right thing, I don't get any of
the messages I logged from inside my custom action using session.Log. My
other custom actions which are directly sequenced in the
InstallExecuteSequence do log messages out, and those messages appear
correctly.
...
--
View this message in context: http://www.nabble.com/Problem-with-DTF-Custom-action-invoked-via-PushButton-Event-%3A-DoAction-tp17719937p17725150.html
Sent from the wix-users mailing list archive at Nabble.com.
Christopher Painter
2008-06-09 02:01:00 UTC
Permalink
Some people have suggested running an async CA prior to the dialog chain and then using an RPC mechanism to pass messages to it for logging and instructing it to shut down.
 
Seems like overkill to me to get around an MSI limitation but if it's really important to you, it can be done.  Of course there is always just dump MSI UI and use an external UI handler.


 
Christopher Painter, Author of Deployment Engineering Blog
Have a hot tip, know a secret or read a really good thread that deserves attention? E-Mail Me

--- On Sun, 6/8/08, Krishna Nadiminti <***@hotmail.com> wrote:

From: Krishna Nadiminti <***@hotmail.com>
Subject: Re: [WiX-users] Problem with DTF Custom action invoked via PushButton Event : DoAction
To: wix-***@lists.sourceforge.net
Date: Sunday, June 8, 2008, 8:44 PM

Thanks Chris!

So is there no known way to log messages from a custom action invoked via
PushButton-DoAction event?

Krishna


chrpai wrote:
>
> This is  known issue with Windows Installer, not
> DTF.    The context/handle is different from
within 
> DoAction ControlEvent rather then  sequenced
CA.   
> MsiProcessMessage calls won't work.
>
>
> Christopher Painter, Author of Deployment Engineering Blog
> Have a hot tip, know a secret or read a really good thread that deserves
> attention? E-Mail Me
>
> --- On Sun, 6/8/08, Krishna Nadiminti
<***@hotmail.com>
> wrote:
>
> From: Krishna Nadiminti <***@hotmail.com>
> Subject: [WiX-users] Problem with DTF Custom action invoked via PushButton
> Event : DoAction
> To: wix-***@lists.sourceforge.net
> Date: Sunday, June 8, 2008, 10:37 AM
>
> Hi Jason,
>
> I've created a few custom actions in C# using your wonderful DTF
> framework.
>
> So far, I found a couple of issues. One of them seems to be a showstopper
> -
> for now.
>
> 1. I invoke my C# custom action when a PushButton raises the DoAction
> control event. The action gets called correctly, (most of the time about
> 80%
> of the time) and while it seems to do the right thing, I don't get any
of
> the messages I logged from inside my custom action using session.Log. My
> other custom actions which are directly sequenced in the
> InstallExecuteSequence do log messages out, and those messages appear
> correctly.
> ...
>
--
View this message in context:
http://www.nabble.com/Problem-with-DTF-Custom-action-invoked-via-PushButton-Event-%3A-DoAction-tp17719937p17725150.html
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Krishna Nadiminti
2008-06-09 04:44:09 UTC
Permalink
Thanks again, Chris.

I agree, having that async CA and the other CA communicating via RPC just
for the log messages to way overkill. It'll probably be lesser work
re-writing the entire UI.

My only concern is though, that I'll have to now look at bootstrapping .NET
Fx, (earlier than expected) - and re-write all those UI dialogs in Winforms
- where in reality I only want to add a couple of dialogs in Winforms to
enhance the internal UI. (Because, the internal UI to select features etc,
disk cost, change install dir etc are all quite nice, and easily done in
Wix).

So, other than this log message issue, do you think there are other problems
with the Winforms + Internal UI mix approach (like the one I'm using)?

Cheers
Krishna
Post by Christopher Painter
Some people have suggested running an async CA prior to the dialog chain
and then using an RPC mechanism to pass messages to it for logging and
instructing it to shut down.
 
Seems like overkill to me to get around an MSI limitation but if it's
really important to you, it can be done.  Of course there is always
just dump MSI UI and use an external UI handler.
--
View this message in context: http://www.nabble.com/Problem-with-DTF-Custom-action-invoked-via-PushButton-Event-%3A-DoAction-tp17719937p17726236.html
Sent from the wix-users mailing list archive at Nabble.com.
Jason Ginchereau
2008-06-09 17:15:03 UTC
Permalink
1. Already answered by Christopher Painter -- Thanks.

2. Based on reports from you and Amy on this list, it would seem the bug is not entirely fixed. I'll have to investigate further. Are there certain API calls that often cause the CA to die? (Setting properties?)
My CA method has a try/catch that surrounds all the code, to catch any exception, log it to the session and return ActionResult.Failure.
Note that is not necessary because the code that calls the CA method does exactly that already.

3. Good suggestion, I'll consider automatically including the PDB in the package for Debug builds. Meanwhile you can accomplish this by editing the project file: set a CustomActionContents property to a semicolon-delimited list of additional files to be included.

4. Any referenced assembly that's in the GAC (and CopyLocal=false) should get loaded automatically by the CLR during the MakeSfxCA step and omitted from the package. That is what I have observed to happen so far, but maybe there is need for further investigation.

-Jason-

-----Original Message-----
From: wix-users-***@lists.sourceforge.net [mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Krishna Nadiminti
Sent: Sunday, June 08, 2008 8:38 AM
To: wix-***@lists.sourceforge.net
Subject: [WiX-users] Problem with DTF Custom action invoked via PushButton Event : DoAction


Hi Jason,

I've created a few custom actions in C# using your wonderful DTF framework.

So far, I found a couple of issues. One of them seems to be a showstopper -
for now.

1. I invoke my C# custom action when a PushButton raises the DoAction
control event. The action gets called correctly, (most of the time about 80%
of the time) and while it seems to do the right thing, I don't get any of
the messages I logged from inside my custom action using session.Log. My
other custom actions which are directly sequenced in the
InstallExecuteSequence do log messages out, and those messages appear
correctly.

2. This is the 80% part. I read a previous post from someone, who said a
similar thing, and your reply saying it was fixed. I'm currently using Wix
v.3.0.4207. But, in my case occasionally it just doesn't work. No error
messages are shown in the log - nothing. Just says my CA died and that's it.
Now, if I rebuild, and re-launch the setup, it generally works. I'm using VS
2008 and Votive by the way, to build stuff. My CA method has a try/catch
that surrounds all the code, to catch any exception, log it to the session
and return ActionResult.Failure.

3. Now, this may be helpful to developers in the future: how about packaging
the .pdb file of the .NET custom action dll along with the dll and
MS.Deployment.dll? This would give people slightly better info regarding the
line number etc where their .NET CA code fails.

4. Another one, related to 3, is the build process for the PackCustomAction
MSBuild target (in the MakeSFX)... My custom action that runs in immediate
mode, during the UI sequence and does not modify the system, shows a
Winforms dialog. I have to show a list of x509 certs to the user to select
one, and Wix UI is simply incapable of doing that. (I really dont want to
hack up the listView control and stuff in Wix/MSI's standard UI - it just
doesn't serve my purpose). Anyway, this Winforms thing actually works but I
had a couple of issues along the way : The MakeSfxCA step after my custom
action compilation complains about System.Windows.Forms not being in my
bin\Debug directory. If I set System.Windows.Forms.dll, and its dependencies
to be copied locally, in VS 2008, then MakeSFX does not complain - otherwise
- it blows up.
I looked into the code to see what it is doing - and understand where and
why it blows up: it tries to load the Assembly dependencies from the
bin\Debug directory (or whereever the .NET CA compiles to), and can't find
it! Now, I think there should be some code in there to avoid checking for
Exported types, and methods decorated with [CustomAction], IF the dependency
is a standard .NET Fx dll or perhaps you could check if the dll is GAC-ed.
Both of these first require to not assume that all the dependencies are in
the bin\Debug directory.

I hope that makes sense. Please let me know what you think.

Thanks,
Krishna.
--
Krishna Nadiminti
2008-06-10 12:52:05 UTC
Permalink
Thanks for the reply Jason.



2. Based on reports from you and Amy on this list, it would seem the bug is
not entirely fixed. I'll have to investigate further. Are there certain API
calls that often cause the CA to die? (Setting properties?)
Well, what I'm really doing is getting / setting some properties from/to
the session. Logging messages to the session. And that's about it. Not
much else to do with the DTF API itself - but I was encrypting stuff
(properties) that I read from the session, showing a form to select x509
certs etc.
My CA method has a try/catch that surrounds all the code, to catch any
exception, log it to the session and return ActionResult.Failure.
Note that is not necessary because the code that calls the CA method does
exactly that already.
Nice. I can get rid of that code then.
3. Good suggestion, I'll consider automatically including the PDB in the
package for Debug builds. Meanwhile you can accomplish this by editing the
project file: set a CustomActionContents property to a semicolon-delimited
list of additional files to be included.
I looked at the MSBuild file and realised I could tweak that to add my
pdb file. But wasnt too sure -- I'm not a MSBuild expert. :)
4. Any referenced assembly that's in the GAC (and CopyLocal=false) should
get loaded automatically by the CLR during the MakeSfxCA step and omitted
from the package. That is what I have observed to happen so far, but maybe
there is need for further investigation.
Hmm...I'm not sure the MakeSfxCa class looks at whether an assembly is
(v.3.0.4207, DTF) - MakeSfxCA hooks up the ReflectionOnlyAssemblyResolve
event, and tries to load all dependent assemblies from the directory where
the managed CA dll compiles to.
In the delegate that you provide, you look in that directory (where the CA
dll was compiled) and try to find the libraries using
ReflectionOnlyLoadFrom.
Jason Ginchereau
2008-06-16 17:08:26 UTC
Permalink
Update regarding #4: CA build behavior relating to GAC assemblies should be much better after a fix in the latest build 3.0.42140.

-----Original Message-----
From: wix-users-***@lists.sourceforge.net [mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Jason Ginchereau
Sent: Monday, June 09, 2008 10:15 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Problem with DTF Custom action invoked via PushButton Event : DoAction

1. Already answered by Christopher Painter -- Thanks.

2. Based on reports from you and Amy on this list, it would seem the bug is not entirely fixed. I'll have to investigate further. Are there certain API calls that often cause the CA to die? (Setting properties?)
My CA method has a try/catch that surrounds all the code, to catch any exception, log it to the session and return ActionResult.Failure.
Note that is not necessary because the code that calls the CA method does exactly that already.

3. Good suggestion, I'll consider automatically including the PDB in the package for Debug builds. Meanwhile you can accomplish this by editing the project file: set a CustomActionContents property to a semicolon-delimited list of additional files to be included.

4. Any referenced assembly that's in the GAC (and CopyLocal=false) should get loaded automatically by the CLR during the MakeSfxCA step and omitted from the package. That is what I have observed to happen so far, but maybe there is need for further investigation.

-Jason-

-----Original Message-----
From: wix-users-***@lists.sourceforge.net [mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Krishna Nadiminti
Sent: Sunday, June 08, 2008 8:38 AM
To: wix-***@lists.sourceforge.net
Subject: [WiX-users] Problem with DTF Custom action invoked via PushButton Event : DoAction


Hi Jason,

I've created a few custom actions in C# using your wonderful DTF framework.

So far, I found a couple of issues. One of them seems to be a showstopper -
for now.

1. I invoke my C# custom action when a PushButton raises the DoAction
control event. The action gets called correctly, (most of the time about 80%
of the time) and while it seems to do the right thing, I don't get any of
the messages I logged from inside my custom action using session.Log. My
other custom actions which are directly sequenced in the
InstallExecuteSequence do log messages out, and those messages appear
correctly.

2. This is the 80% part. I read a previous post from someone, who said a
similar thing, and your reply saying it was fixed. I'm currently using Wix
v.3.0.4207. But, in my case occasionally it just doesn't work. No error
messages are shown in the log - nothing. Just says my CA died and that's it.
Now, if I rebuild, and re-launch the setup, it generally works. I'm using VS
2008 and Votive by the way, to build stuff. My CA method has a try/catch
that surrounds all the code, to catch any exception, log it to the session
and return ActionResult.Failure.

3. Now, this may be helpful to developers in the future: how about packaging
the .pdb file of the .NET custom action dll along with the dll and
MS.Deployment.dll? This would give people slightly better info regarding the
line number etc where their .NET CA code fails.

4. Another one, related to 3, is the build process for the PackCustomAction
MSBuild target (in the MakeSFX)... My custom action that runs in immediate
mode, during the UI sequence and does not modify the system, shows a
Winforms dialog. I have to show a list of x509 certs to the user to select
one, and Wix UI is simply incapable of doing that. (I really dont want to
hack up the listView control and stuff in Wix/MSI's standard UI - it just
doesn't serve my purpose). Anyway, this Winforms thing actually works but I
had a couple of issues along the way : The MakeSfxCA step after my custom
action compilation complains about System.Windows.Forms not being in my
bin\Debug directory. If I set System.Windows.Forms.dll, and its dependencies
to be copied locally, in VS 2008, then MakeSFX does not complain - otherwise
- it blows up.
I looked into the code to see what it is doing - and understand where and
why it blows up: it tries to load the Assembly dependencies from the
bin\Debug directory (or whereever the .NET CA compiles to), and can't find
it! Now, I think there should be some code in there to avoid checking for
Exported types, and methods decorated with [CustomAction], IF the dependency
is a standard .NET Fx dll or perhaps you could check if the dll is GAC-ed.
Both of these first require to not assume that all the dependencies are in
the bin\Debug directory.

I hope that makes sense. Please let me know what you think.

Thanks,
Krishna.
--


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

Christopher Painter
2008-06-09 17:28:06 UTC
Permalink
That was my first natural inclination also.  I think it's going to be a hard habit for developers to kick.
 
 
>> My CA method has a try/catch that surrounds all the code, to catch any exception, log it to the session and return ActionResult.Failure.
 
>Note that is not necessary because the code that calls the CA method does exactly that already.

 
Christopher Karper
2008-06-09 17:47:04 UTC
Permalink
I started doing it after my CA's started failing with no return info.

Chris
That was my first natural inclination also. I think it's going to be a
hard habit for developers to kick.
Post by Jason Ginchereau
My CA method has a try/catch that surrounds all the code, to catch any
exception, log it to the session and return ActionResult.Failure.
Post by Jason Ginchereau
Note that is not necessary because the code that calls the CA method does
exactly that already.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
https://lists.sourceforge.net/lists/listinfo/wix-users
Loading...