[Mono-bugs] [Bug 500075] New: <%@Page%> Inherits doesn't support C# syntax

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri May 1 11:28:16 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=500075


           Summary: <%@Page%> Inherits doesn't support C# syntax
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86-64
        OS/Version: openSUSE 11.1
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Web
        AssignedTo: mhabersack at novell.com
        ReportedBy: jpryor at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Many existing ASP.NET MVC applications (such as NerdDinner) use C# syntax to
declare a generic base type within the <%Page Inherits%> attribute.  For
example, from NerdDinner/Views/Dinners/Index.aspx:

<%@ Page
Inherits="System.Web.Mvc.ViewPage<NerdDinner.Helpers.PaginatedList<NerdDinner.Models.Dinner>>"
Language="C#" MasterPageFile="~/Views/Shared/Site.Master" %>

The problem is that Mono's ASP.NET doesn't properly parse
ViewPage<PaginatedList<Dinner>>, and instead "falls back" to using the
non-generic ViewPage type.  This results in compilation errors later in the
page, e.g.

         <% foreach (var dinner in Model) { %>

results in:

Compiler Error Message: CS1579: foreach statement cannot operate on
variables of type `object' because it does not contain a definition for
`GetEnumerator' or is not accessible

The workaround is to change the <%@Page Inherits="..."%> syntax to use
Reflection syntax, for example:

<%@ Page
Inherits="System.Web.Mvc.ViewPage`1[[NerdDinner.Helpers.PaginatedList`1[[NerdDinner.Models.Dinner,
NerdDinner]], NerdDinner]]" Language="C#"
MasterPageFile="~/Views/Shared/Site.Master" %>

This has the unfortunate side effect that all existing ASP.NET code needs to be
touched in order to be hosted on Mono.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list