We have the following shared component:
public class OurServiceBase : System.ServiceProcess.ServiceBase
This class has functionality we want in all our downstream services, such as standardized execution scheduling and logging functionality.
In a new project, I add the following:
public class MyService : System.ServiceProcess.ServiceBase
In the Windows Designer, the class shows properly.
When I change the service to derive from OurServiceBase
public class MyService : OurSharedLibrary.OurServiceBase
The designer stops working:
The full error is:
The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: EmailProcessor --- The base class 'OurSharedLibrary.CienaServiceBase' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
The proper assemblies are referenced, the project builds. I don't understand why the designer is flipping out over this since my service ultimately does derive from a designable class.
Any suggestions would be most welcome.
Bit more information - the call stack from the designer when it renders the error about not being able to design the derived service:
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
7/19/2011 2:34PM EDT New discovery.
Class "OurServiceBase" exists in a separate project (usually referenced as a DLL only). On a whim, I copied the base class file into my project, built, and opened the designer. It worked! When I removed the base class file again and returned to the external DLL reference, the designer broke again.