Hello!
I built a modal dialog custom control. It shows up by creating an instance and calling the Show-method. When the user closes the dialog a callback method provided by the caller is being invoked. I implemented this using the PopUp class.
It seemed to work great but any now and then an UnhandledException (HRESULT E_FAIL in COM component) is being raised. It took me a lot of time to find out that the problem is probably about garbage collection. I'm using automated tests now to reproduce the issue. Please take a look at what happens step by step:
- ModalDialog instance is being created in a method of 'Page'
- ModalDialog.Show() is being called in the same method of 'Page'
- ModalDialog creates an instance of PopUp and adds itself(!) as the PopUp-child
....
- ModalDialog.Show() returns
- The method of the Page returns
I think this is the point where bad things might happen. I supposed that my instance of ...
Go to the complete details ...