Yup, based on the architecture of how the designer interacts and displays classes, this is a design issue rather than a bug. Specifically, in order to display items in the designer, the designer must first instantiate those items. So, when you are dragging a textbox on a form, the designer creates an actual instance of the textbox. In the case of a UserControl or a Form, however, the designer must instantiate the base version for display as, by designing, you are modifying he class definition. Thus, it tries to instantiate the "MustInherit" form. To workaround this, you need to make your base form declaration and signatures look like this:
#If DEBUG Then Public Class MyForm #Else Public MustInherit Class MyForm #End If
...
#If DEBUG Then Public Overridable Sub Foo() Throw New NotImplementedException() End Sub #Else Public MustOverride Sub Foo() #End If
End Class
Therefore, you will be able to display the derived form in the designer when in Debug mode. However, once you switch to release mode, you will not be able to display the derived form in the designer.
Hope this helps.
|