This project is read-only.

Compilation errors

Topics: blog
May 14, 2011 at 9:21 PM


I've downloaded the code connecting directly to the source control and the solution don't compile at all. These are the errors:

Error    44    No overload for method 'Start' takes 0 arguments    C:\Work\HttpServer.v1.1\trunk\HttpServer.MVC2\MvcServer.cs    15    13    HttpServer.MVC2
Error    50    The best overloaded method match for 'System.Collections.Generic.List<System.Reflection.MethodBase>.this[int]' has some invalid arguments    C:\Work\HttpServer.v1.1\trunk\HttpServer.MVC2\Controllers\ControllerMapping.cs    69    36    HttpServer.MVC2
Error    51    Argument 1: cannot convert from 'string' to 'int'    C:\Work\HttpServer.v1.1\trunk\HttpServer.MVC2\Controllers\ControllerMapping.cs    69    45    HttpServer.MVC2
Error    52    No overload for method 'Add' takes 2 arguments    C:\Work\HttpServer.v1.1\trunk\HttpServer.MVC2\Controllers\ControllerMapping.cs    78    13    HttpServer.MVC2


The first error is easy to correct as the Start method now requires an int value with the backlog of pending requests to accept.

The second error I just can't resolve easily as if tries to index a List<> of MethodBase with a string. This is is MVC2.Controllers.ControllerMapping:

The list is:        

  private List<MethodBase> _actions = new List<MethodBase>();

and the method is:

        internal IActionResult Invoke(IController instance, string action, object[] arguments)
            return  (IActionResult)_actions[action].Invoke(instance, arguments);

See that action is string so it can't be used to index _action which is List<MethodBase>

The third error occurs because of the second error.

The fourth error shows that you are probably trying to use a Dictionary<string, MethodBase> instead of the List<MethodBase>

Did I get the wrong version from the repository? If not, then why is the repository left in a state that it doesn't compile?

May 21, 2011 at 5:43 AM

Did you download off the trunk? Because that's a WIP, I downloaded it a while back and was marred with errors like that too. Download the branches.

Jun 16, 2011 at 5:52 AM

I'll fix trunk tomorrow. You need to unload the XXXX2 project and everything will compile fine.

Jun 30, 2011 at 8:02 PM

Trunk have been fixed.