views:

93

answers:

1

In a Visual Studio website, I have created a user control. This control is derived from a class (in App_Code) that is itself derived from System.Web.UI.UserControl. This is an abstract class with an abstract method. I then try to implement that method in the user control, but I get the following errors from Visual Studio:

Error   1   'WebUserControl.AbstractMethod()': no suitable method found to override C:\Users\User\Documents\Visual Studio 2010\WebSites\Delme\WebUserControl.ascx.cs    10  28  C:\...\Delme\

Error   2   'WebUserControl' does not implement inherited abstract member 'AbstractBaseClass.AbstractMethod()'  c:\Users\User\AppData\Local\Temp\Temporary ASP.NET Files\delme\0eebaa86\f1a48678\App_Web_nrsbzxex.0.cs  14  

Error 1 says that my override of the abstract method is invalid, it doesn't recognise the abstract method in the base class. Error 2 says that the partial class automatically built by asp.net doesn't implement the abstract method!

Note that this works fine when the code is used in a Web Application project.

Why is this happening?

A: 

The answer was that the abstract method in the base class was marked as internal. While this is fine for web application projects where the classes all end up in the same assembly, a website does things differently. I guess the automatically created half of the partial class does not end up in the same assembly as my half, and so the internal keyword was breaking it.

Sprintstar