I don't know if this helps you, but I can tell about my experiences regarding
the debugging of DTF managed custom actions.
The CA's I wrote for a customer setup do things like account verification and
creation, configuration of DCOM settings, registry manipulation and such. This
means: They actually don't really require to be run from an MSI except for of
course the MSI Properties they get their information from.
However, I needed a way of quickly testing the functionality of my custom
actions, so I wrote a thin wrapper class around Session and CustomActionData
and then simply used the Visual Studio integrated Unit Testing methods. This
way I am able to run an automated Unit Test against a custom action (and even
debug into it) and also use the very same code to use the CA from within an MSI.
Besides wrapping the MSI Properties within my MockSession class, I also of
course wrapped the Log and the Message functions. This way I can easily output
information to a tracer for example.
A valid example for a CA Unit test looks like this:
<TestMethod()> _
Public Sub TTAccountValidateNewUserInformationTest_PasswordMissmatch()
Dim expected As ActionResult = ActionResult.Success
Dim expectedResult = "0"
TTAccountHelper.MockSession(TTAccountHelper.NewUserServerProperty) =
System.Net.Dns.GetHostName().ToUpper()
TTAccountHelper.MockSession(TTAccountHelper.NewUserNameProperty) =
"CustomActionTestUser"
TTAccountHelper.MockSession(TTAccountHelper.NewUserPasswordProperty) =
"ABCDEFGH"
TTAccountHelper.MockSession(TTAccountHelper.NewUserConfirmProperty) =
"HGFEDCBA"
Dim actual As ActionResult =
TTAccountHelper.TTAccountValidateNewUserInformation(Nothing)
Assert.AreEqual(expected, actual)
Dim actualResult As String =
TTAccountHelper.MockSession(TTAccountHelper.ValidUserProperty)
Assert.AreEqual(expectedResult, actualResult)
End Sub
This one sets a couple of properties and afterwards checks if another property
contains the expected value.
The CA itself basically starts like this:
<CustomAction()> _
Public Shared Function TTAccountValidateNewUserInformation(ByVal session As
Session) As ActionResult
If (Not session Is Nothing) Then _mockSession = New MockSession(session)
_mockSession.Log("Begin TTAccountValidateNewUserInformation")
Dim valid As Boolean = True
...
_mockSession(ValidUserProperty) = IIf(valid, "1", "0")
_mockSession.Log("End TTAccountValidateNewUserInformation")
Return ActionResult.Success
End Function
So if it is called from an MSI, the MockSession class is initialized with the
session and thus uses the MSI Properties. Otherwise it uses its own properties
set by the Unit Test.
The MockSession class is inherited from DictionaryBase so that it supports the
same calling conventions for Properties:
<DefaultMember("Item")> _
Public Class MockSession
Inherits DictionaryBase
Private session As Session = Nothing
Public CustomActionData As New MockCustomActionData(Nothing)
Public Sub New(ByVal session As Session)
Me.session = session
If (Not session Is Nothing) Then CustomActionData = New
MockCustomActionData(session)
End Sub
...
Maybe someone can make use of this somehow. ;-) For me it's pretty useful. And
although it is not really a hard thing to implement, I might write an article
about it, lol
-----Ursprüngliche Nachricht-----
Von: Christopher Painter [mailto:[email protected]]
Gesendet: Mittwoch, 25. Februar 2009 22:27
An: General discussion for Windows Installer XML toolset.
Betreff: [WiX-users] DTF Debugging
Is anyone having problems having trouble debugging DTF CA's?
I used to be able to set the MMsiBreak environment variables and step into my
code without any difficulty but now when I attach the debugger I get an error
message saying that no symbols are loaded for any stack frame. The source code
cannot be displayed.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users