title: How to access session custom action data (properties) during install and uninstall in Wix?
body: <p>Can you please tell me what is wrong with the following code? I am able to access the custom action data during install and I add their values to session custom action collection. However, during uninstall I the value pairs are not in the collection.</p>
  
  <pre><code>public class CustomActions
  {
      //This action is only called during application install
      [CustomAction]
      public static ActionResult CreateToolbar(Session session)       
      {
          //This works fine the value is properly sent from wix script
          //The variable toolbarName has the expected value
          string toolbarName = session["VSTOCustomAction_ToolbarName"];
  
          //Save the value for uninstaller
          session.CustomActionData.Add("VSTOCustomAction_ToolbarName", toolbarName);
          ...
      }
  
      //This action is only called during application uninstall
      [CustomAction]
      public static ActionResult RemoveToolbar(Session session)
      {
          //Get the toolbar name and remove it
          //Why does the following call return null?
          string toolbarName = session.CustomActionData["VSTOCustomAction_ToolbarName"];          
          ...
      }
  }
  
  Below is the WIX part that calls the above custom action.
  
  &lt;!-- Include the VSTO Custom action  --&gt;
  &lt;Binary Id="VSTOCustomAction" SourceFile="CustomAction.CA.dll"/&gt;
  &lt;CustomAction Id="CreateToolbar" BinaryKey="VSTOCustomAction" DllEntry="CreateToolbar" Execute="immediate"/&gt;
  &lt;CustomAction Id="RemoveToolbar" BinaryKey="VSTOCustomAction" DllEntry="RemoveToolbar" Execute="immediate"/&gt;
  ...
  &lt;CustomAction Id="PropertyAssign_ToolbarName" Property="VSTOCustomAction_ToolbarName" Value="MyToolBarName"/&gt;
  ...
  &lt;!-- Modify the install sequence to call our custom action --&gt;
  &lt;InstallExecuteSequence&gt;
    &lt;Custom Action="PropertyAssign_ToolbarName" Before="CreateToolbar"&gt;&lt;![CDATA[(&amp;ToolbarComponent = 3) AND NOT (!ToolbarComponent = 3)]]&gt;&lt;/Custom&gt;
    &lt;Custom Action="CreateToolbar" After="InstallFinalize"&gt;&lt;![CDATA[(&amp;ToolbarComponent = 3) AND NOT (!ToolbarComponent = 3)]]&gt;&lt;/Custom&gt;
    &lt;Custom Action="RemoveToolbar" After="InstallFinalize"&gt;&lt;![CDATA[(&amp;ToolbarComponent = 2) AND NOT (!ToolbarComponent = 2)]]&gt;&lt;/Custom&gt;
  &lt;/InstallExecuteSequence&gt;   
  </code></pre>