Problem with transfering data

Aug 30, 2016 at 7:41 AM
Hi, Oleg!
I have a problem with transfering data from UIInitialized event handler to my custom dialog.

static void project_UIInitialized(SetupEventArgs e)
{
e.Data["TEST"] = "test";
}

void dialog_Load(object sender, EventArgs e)
{
string testData = MsiRuntime.Data["TEST"];
}

MsiRuntime.Data["TEST"] throw KeyNotFoundException in Load form event handler
Coordinator
Aug 30, 2016 at 11:21 AM
Thank you. Yes it is a problem with e.Data: https://wixsharp.codeplex.com/workitem/139.

e.Data dictionary was introduce as an equivalent of Session dictionary but with the ability to survive the journey to the deferred actions. Something that MSI Session cannot do. Though in your case you are not dealing with deferred actions so you don't have to use Data and you can save the data directly in the session dictionary:
static void project_UIInitialized(SetupEventArgs e) 
{
    e.Session["TEST"] = "test";
} 

void dialog_Load(object sender, EventArgs e) 
{
    string testData = MsiRuntime.Session["TEST"];
} 
However the defect you have repored is a defect and it needs to be fixed.

The issue is solved now (Git) and I am planing to do the release tomorrow (or so).