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
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With