Pavel,
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.
Chris