sorry for the delay I didn't forget about this issue but I was very busy these days. I have found the "thing" that is causing the error and it is related to Web site Project and WAP co-operation.
If you inherit UserControl / WebPart that is build on top of the WAP and you are using the Web site project type the ASP.NET has an issue related to building the control tree so that's why we don't get the control instances - they are all null.
Basically this issue is related to ASP.NET AutoEventWireup
functionality and when you turn this on (and it is turned on by default) then Web site (for some unknown reason) overrides the WAP control tree generation and controls are not instantiated. Dirty fix that I have found is to disable this functionality in case of the Web site project type so you can use the inherited WebPart (Note: at this point I didn't find issues that you may face using this fix but I'm not sure that they won't arise later on). Don' forget that If you disable the AutoEventWireup
then you need to override the events such as Page_Load
To implement dirty fix change the below code from:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Pollmaster.ascx.cs" Inherits="MonoX_ModuleGallery_Pollmaster" %>
<%@ Control Language="C#" AutoEventWireup="false" CodeFile="Pollmaster.ascx.cs" Inherits="MonoX_ModuleGallery_Pollmaster" %>
I hope that this will work for you, please let us know if you need any further information.