I recently upgraded a project I am working on to RC1 and I am absolute pulling my hair out. I am using AbsoluteRouting and I keep getting the following issue which is preventing me from upgrading. I have know cllue about whether you have any ideas but I thought I would see if you did (really appreciate any help you can provide :) )
After migrating I get this error:
Global.asax.cs
routes.Add(new EnableAbsoluteRouting()
.SetPort("http", 2008)
.SetPort("https", 450));
routes.Add(new Route("Login/SignIn", new MvcRouteHandler()) {
Defaults = new RouteValueDictionary(new { controller = "Login", action = "SignIn" })
});
Control(*.ascx) inside View
<% using (Html.Form<LoginController>(c => c.SignIn())) { %>
EnableAbsoluteRouting.cs:
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
{
using (RouteTable.Routes.GetReadLock())
{
foreach (var routeBase in RouteTable.Routes)
{
if (routeBase != this)
{
/// Error there:
var vpd = routeBase.GetVirtualPath(requestContext, values);
if (vpd != null)
return EnsureCorrectScheme(requestContext, routeBase, vpd);
}
}
}
return null;
}
NullReferenceException:
" at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()\r\n
at System.Web.Routing.ParsedRoute.Bind(RouteValueDictionary currentValues, RouteValueDictionary values, RouteValueDictionary defaultValues,
RouteValueDictionary constraints)\r\n at System.Web.Routing.Route.GetVirtualPath(RequestContext requestContext,
RouteValueDictionary values)\r\n at System.Web.Routing.RouteCollection.GetVirtualPath(RequestContext requestContext,
RouteValueDictionary values)\r\n at Microsoft.Web.Mvc.LinkBuilder.BuildUrlFromExpression[T](ViewContext context,
Expression1 action)\r\n at Microsoft.Web.Mvc.LinkExtensions.BuildUrlFromExpression[T](HtmlHelper helper, Expression
1 action)\r\n
at Microsoft.Web.Mvc.MvcForm1..ctor(HtmlHelper helper, HttpContextBase context, Expression
1 postAction, FormMethod method,
RouteValueDictionary htmlAttributes)\r\n at Microsoft.Web.Mvc.FormExtensions.Form[T](HtmlHelper helper, Expression`1 postAction,
FormMethod method, IDictionary`2 htmlAttributes)\r\n at Microsoft.Web.Mvc.FormExtensions.Form[T](HtmlHelper helper,
Expression`1 postAction)\r\n at ASP.views_shared_controls_quicklogincontrol_ascx.__Render__control1(HtmlTextWriter __w,
Control parameterContainer) in
d:\ Projects\WebSite\Views\Shared\Controls\LoginControl.ascx:line 11\r\n
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)\r\n
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)\r\n at System.Web.UI.Control.Render(HtmlTextWriter writer)\r\n
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)\r\n
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)\r\n
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)\r\n
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)\r\n
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)\r\n at System.Web.UI.Page.Render(HtmlTextWriter writer)\r\n
at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)\r\n
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)\r\n
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)\r\n
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)\r\n
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"
Any ideas would really assist :)