Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate method 'ProcessRequest' in ASPX

Tags:

asp.net-mvc

f#

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

like image 795
Mauricio Scheffer Avatar asked Apr 28 '10 04:04

Mauricio Scheffer


1 Answers

Unfortunately, I'm not sure if there is any way to declare a new virtual member in F#. A quick look through the spec didn't turn up anything promising...

like image 93
kvb Avatar answered Oct 19 '22 22:10

kvb