Duplicate method 'ProcessRequest' in ASPX

Posted by Mauricio Scheffer on Stack Overflow See other posts from Stack Overflow or by Mauricio Scheffer
Published on 2010-04-28T04:58:55Z Indexed on 2010/04/28 5:03 UTC
Read the original article Hit count: 429

Filed under:
|

I'm trying to code ASP.NET MVC views (WebForms view engine) in F#. I can already write regular ASP.NET WebForms ASPX and it works ok, e.g.

<%@ Page Language="F#" %>
<%
for i in 1..2 do %>
<%=sprintf "%d" i %>

so I assume I have everything in my web.config correctly set up.

However, when I make the page inherit from ViewPage:

<%@ Page Language="F#" Inherits="System.Web.Mvc.ViewPage" %>

I get this error:

Compiler Error Message: FS0442: Duplicate method. The abstract method 'ProcessRequest' has the same name and signature as an abstract method in an inherited type.

The problem seems to be this piece of code generated by the F# CodeDom provider:

[<System.Diagnostics.DebuggerNonUserCodeAttribute>]
abstract ProcessRequest : System.Web.HttpContext -> unit
[<System.Diagnostics.DebuggerNonUserCodeAttribute>]
default this.ProcessRequest  (context:System.Web.HttpContext) =
    let mutable context = context
    base.ProcessRequest(context) |> ignore

when I change the Page directive to use C# instead, the generated code is:

[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public new virtual void ProcessRequest(System.Web.HttpContext context) {
    base.ProcessRequest(context);
}

which of course works fine and AFAIK is not semantically the same as the generated F# code.

I'm using .NET 4.0.30319.1 (RTM) and MVC 2 RTM

© Stack Overflow or respective owner

Related posts about F#

Related posts about asp.net-mvc