I’m spending a lot of time lately with the designer infrastructure and I don’t know why it’s so badly documented. I'm posting some tips that you may find useful when working with design time stuff:
- The designers are cached so if you have opened a WebForm, make sure you reopen it again to test your changes. Otherwise you will be running an old version of your designer.
- The design time life cycle is very reduced from the usual life cycle:
- Only the Init and Render stages are executed (no PreInit, PreLoad, Load, LoadComplete, PreRender or UnLoad stages are executed).
- There’s no Context.
- When there’s an error in a designer, very little information about the error is shown. Change the GetErrorDesignTimeHtml to display the stack trace so you can figure out where the error is without having to debug the component:
protected override string GetErrorDesignTimeHtml(Exception e)
return CreateErrorDesignTimeHtml("Error creating the control " + e.StackTrace.ToString(), e);
- If your component is a class library you can debug it, choosing project properties->debug->start external program->(put complete path to devenv.exe).
That's all for now.