I have made some addin in VB.NET 2003 for EG 4.1 that worked just fine, but it´s not working in EG 4.2 any more. I have tried to recompile the addin in Visual Studio 2005 using EG 4.2 SAS.Shared.AddIns.dll, but with no success. The problem is that the property SasCode() doesn´t take variables from function Show() which are posted from the form.
In show() I have eg.:
Dim frm As MyAddinForm = New MyAddinForm
If frm.ShowDialog(Owner) = Windows.Forms.DialogResult.OK Then
var1 = frm.var ' variable var is declared by pressing OK button on the form
Else : Return ShowResult.Canceled
The issue is that you cannot rely on the state of variables in the UI portion of your task to stay valid when your task is run. That's why you must store the state information using the XmlState property. EG will call the get method on XmlState when your task UI is closed. And then it will re-instantiate your task class and set the XmlState property when the task is run.
In this way, EG keeps the state of your task in the project for use later, even if you don't show the UI again (for example, when you run the process flow).
If it worked for you in 4.1, it was by luck...not by design. It just happened to be that the task objects were not disposed immediately. In 4.2, we improved the memory management of tasks to keep the application memory footprint lower, so this probably closed the loophole you relied upon in 4.1.