This project is read-only.

Problem with MVC RC1

Jan 30, 2009 at 7:13 PM
I  installed the newest MVC RC1 and ever since my Kigg is crashing. Kigg seems to be using its own dlls, so the version of MVC on the machine should not matter, but it seems it does. Anyways, below is the error. Any suggestions would be appreciated

Value cannot be null.
Parameter name: httpContext

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: httpContext

Source Error:

Line 8:          public static UrlHelper Url(this ControllerContext controllerContext)
Line 9:          {
Line 10: return new UrlHelper(new RequestContext(controllerContext.HttpContext, controllerContext.RouteData));Line 11:         }
Line 12:     }

Source File: C:\Projects\KiggV2\Web\Extension\ControllerContextExtension.cs    Line: 10

Stack Trace:

[ArgumentNullException: Value cannot be null.
Parameter name: httpContext]
   System.Web.Routing.RequestContext..ctor(HttpContextBase httpContext, RouteData routeData) +40262
   Kigg.Web.ControllerContextExtension.Url(ControllerContext controllerContext) in C:\Projects\KiggV2\Web\Extension\ControllerContextExtension.cs:10
   Kigg.Web.AutoRefreshAttribute.BuildUrl(ControllerContext filterContext) in C:\Projects\KiggV2\Web\Filters\AutoRefreshAttribute.cs:145
   Kigg.Web.AutoRefreshAttribute.OnResultExecuting(ResultExecutingContext filterContext) in C:\Projects\KiggV2\Web\Filters\AutoRefreshAttribute.cs:136
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +70
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +517
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +278
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +782
   System.Web.Mvc.Controller.ExecuteCore() +154
   System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +162
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
Jan 31, 2009 at 2:02 AM
Ok. it seems there were multiple versions of system.web.mvc. Remove the line in web.config where it is adding system.web.mvc with version number 1.0.0.0 under debug\assemblies node and it works fine
Jan 31, 2009 at 11:30 PM
I just installed the MVC RC yesterday and am having the same issues.  I also tried removing the assembly line from the web.config but to no avail.  I also tried changing the version number to the new version number of the .dll which is 1.0.40128.0 but that didn't work either.

Any help would be greatly appreciated.
Feb 1, 2009 at 12:23 AM

The issue is that ControllerContext no longer inherits from RequestContext as mentioned in Phil Haack's blog...

ASP.NET MVC Release Candidate

That said, I could use some guidance on how to get around this issue.


Feb 1, 2009 at 2:52 AM

There are different copies of the system.mvc.dll in differenct places. Remove a directory under C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files with the name of your site. This is a cache version and gets created again, once you run the solution. Then under c:\windows\assembly\gac_MSIL, there is a directory named system.web.mvc. delete the contents of that directory.

Copy the new Mvc RC1 dlls to the bin directory of your project, or you can just load the projects to your solution and make sure your references are pointing to those dlls. Once you compile the code you get about 3 errors related to RequestContext. In every case, just modify the code, since the object that is complaining about has a RequestContext member (just put .RequestContext). Comment the line in web.config related to loading the system.mvc.dll.

For me the above steps solved the issue and it is running with MVC RC1. However, now I have anothe issue which is I cannot add any stories and all the wait screens(from jQuery) stay there for ever. It seems the success event does not go back to the page.

Hope it helps.
Feb 2, 2009 at 11:16 PM
Thanks for the information.  There are more problems related to the MVC RC1.  It looks the writers of Kigg need to do some work to update the code a bit.
Feb 4, 2009 at 3:44 AM
Just inform you, that the codebase is upgraded to RC1.
Feb 4, 2009 at 7:57 AM
Thanks for the new code. I am still having some issues. When you go to Submit a Story, after you enter the data and click the submit button on the bottom of the page, it shows the "Submitting the story" wait box and it kind of hangs there. If I debug, the request never hits the storycontroller submit function(the one that accepts Http Post). The jQuery script calls the ajaxsubmit, but the function never gets hit. Is it a kigg problem or MVC RC1 problem or is it my Problem?
Feb 4, 2009 at 6:06 PM
Hi BBok,

I have reuploaded the code, It was an issue with the latest MVC RC1, where you have to mark the controller method with ValidateInput(true) when the method accepts the html value in the parameter.