Matthew Adams co-author of
Windows Forms in a
Nutshell has just start a
blog. His 2nd entry "
What
has the designer done now" has some excellent tips on working with the
designer. My favourite is:
You can build a control that has an implementation bug that causes an
exception at deisgn time. Everything will build fine, but when you reopen the
designer you'll see the exception text.
...
Fixing it can be tricky.
If inspection doesn't work, a handy tip is to open a second IDE, and attach to
the original instance of VS.NET. You can then set some breakpoints in your
control and watch what happens as you open the designer.
Sweet - I occasionally encounter this problems - usually when I've split a
common base class out of several forms. No finally I can try to debug them.
Thanks Matthew.
Earlier today I got myself into a little trouble, I had been calling
BeginInvoke() to act as a PostMessage() to display a new object only after its
parent had been created. When running under full trust this worked very
well, however as soon as someone (not I oops) tested in the default internet
trust - Boom a security exception. It turns out that BeginInvoke() calls
MarshaledInvoke() which eventually calls CompressedStack.GetCompressedStack()
which has a link demand for Unmanaged code. Unsurprisingly code deployed from
the internet doesn't get this permission by default.