Lab 6: InteractionHistoryView Load event not fired

Topics: CAB & Smart Client Software Factory
Aug 18, 2005 at 11:32 AM
originally posted by: TheJet

OK,
Let me preface the post with a note that I am running the July CTP. I have done all the necessary machinations and conversions to make everything work properly with the CTP release and up to this point, all labs have been functioning properly.

When I run the final exercise in Lab 6 both my walkthrough version and the "solution" version, the WebBrowser control never gets sent to the appropriate location. I have traced this down to when the UserControl's OnLoad event is fired. In the designer generated code, there is a line like this:

this.Load += new System.EventHandler(this.InteractionHistoryView_Load);

Obviously, this ties in a new event handler to the UserControl's Load event. However, it was not getting fired properly I was never getting into the Event handler, so I investigated a bit further. I overrode the OnLoad() method and determined that it was in fact calling the OnLoad() method, but that the associated event handler list was empty. This lead me to the InitializeComponent() call...

What I found is that the InteractionHistoryView control's OnLoad() method was being called when the web browser control was added to the user control's control collection, e.g.:

this.Controls.Add(this.webBrowser1);

Swapping the order of the control addition specifically pointed me to the WebBrowser control as the control at fault. This seems to me to be a fundamental bug in the WebBrowser/UserControl base class implementations, since the OnControlCreated() which fires the OnLoad() method method should not be called until the user control is actually added to a parent control collection. It certainly should not be occurring as part of the control's constructor I wouldn't think.

I was able to work around the problem by moving the assignment of the Load event handler above the webBrowser1 control addition, but is there somewhere else I should be reporting this issue?
Aug 19, 2005 at 3:40 AM
originally posted by: BradWilsonMSFT

Thanks, we'll look into this.