Today, while trying to open a user control inheriting an abstract class in the designer I got the following error message:
The designer must create an instance of type <some type> but it cannot because the type is declared as abstract.
Apparently, when a form/user control is inheriting from an abstract
class it cannot be open for view in the designer. Haven't really looked
up how and why this happens and why is it so hard for the designer to
handle this kind of situation. What I did found is a nice work-around
for the problem. Actually it's very simple, just go to the abstract
class definition and modify it to look something like that:
#if DEBUG
public class AbstractClass
#else
public abstract class AbstractClass
#endif
After that modification the designer had no problems loading my
control. I'd love to hear about other (more sophisticated maybe ?) ways
to deal with the issue.
Have a nice designing.