Compiling ASP.NET MVC 1.0 on Mono.

3 messages Options
Embed this post
Permalink
Tom Opgenorth

Compiling ASP.NET MVC 1.0 on Mono.

Reply Threaded More More options
Print post
Permalink
Hello all,

For my own curiousity, I tried to compile the ASP.NET MVC 1.0 source
code on Mono 2.4.3 (Ubuntu 9.10 x64).  When I do so under either
MonoDevelop or xbuild, I get this error message:

Mvc/FormCollection.cs(24,6):   error CS0246:  The type or namespace
name `FormCollectionBinder' could not be found. Are you missing a
using directive or an assembly reference?

Now, FormCollectionBinder is an attribute that adorns the class
System.Web.MVC.FormCollection.  The declaration of
FormCollectionBinderAttribute is a private sealed class inside of
FormCollection.  If I move the code for this attribute outside of the
class declaration for FormCollection and then try to compile, there
seems to be no problems.

Could this be a bug with the compiler?  A simpler case is this:

using System;

namespace Test
{
        [MyAttribute]
        public class MyClass
        {
                private sealed class MyAttribute: Attribute
                {
                       
                }
                public void MyMethod()
                {
                  Console.WriteLine("Hello World!");
                }
        }
}

I could not get this to compile on Mono 2.4.3.  Or, is there something
special one must do to get this to compile?


--
http://www.opgenorth.net
_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Marek Habersack

Re: Compiling ASP.NET MVC 1.0 on Mono.

Reply Threaded More More options
Print post
Permalink
Tom Opgenorth wrote:
> Hello all,
Hello,

>
> For my own curiousity, I tried to compile the ASP.NET MVC 1.0 source
> code on Mono 2.4.3 (Ubuntu 9.10 x64).  When I do so under either
> MonoDevelop or xbuild, I get this error message:
>
> Mvc/FormCollection.cs(24,6):   error CS0246:  The type or namespace
> name `FormCollectionBinder' could not be found. Are you missing a
> using directive or an assembly reference?
>
> Now, FormCollectionBinder is an attribute that adorns the class
> System.Web.MVC.FormCollection.  The declaration of
> FormCollectionBinderAttribute is a private sealed class inside of
> FormCollection.  If I move the code for this attribute outside of the
> class declaration for FormCollection and then try to compile, there
> seems to be no problems.
>
> Could this be a bug with the compiler?  A simpler case is this:
Yes, and the bug was fixed after 2.4.3 was released.

>
> using System;
>
> namespace Test
> {
> [MyAttribute]
> public class MyClass
> {
> private sealed class MyAttribute: Attribute
> {
>
> }
> public void MyMethod()
> {
> Console.WriteLine("Hello World!");
> }
> }
> }
>
> I could not get this to compile on Mono 2.4.3.  Or, is there something
> special one must do to get this to compile?
A workaround is to move the attribute class outside its containing type.

marek


_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Tom Opgenorth

Re: Compiling ASP.NET MVC 1.0 on Mono.

Reply Threaded More More options
Print post
Permalink

On Sat, Oct 31, 2009 at 15:40, Marek Habersack <[hidden email]> wrote:
Now, FormCollectionBinder is an attribute that adorns the class
System.Web.MVC.FormCollection.  The declaration of
FormCollectionBinderAttribute is a private sealed class inside of
FormCollection.  If I move the code for this attribute outside of the
class declaration for FormCollection and then try to compile, there
seems to be no problems.

Could this be a bug with the compiler?  A simpler case is this:
Yes, and the bug was fixed after 2.4.3 was released.
I just ended up tweaking the ASP.NET MVC source and moved the code for the attribute outside the class, all is good now.
 
 


--
http://www.opgenorth.net


_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list