I have been playing around with the XamlAsyncController, which is based on ASP.NET MVC 2, and tried upgrading it to MVC 3. However, although the original application works OK, if I try to run it in MVC 3, I get a NullReferenceException when attempting to access ValueProvider.
I’ve tried explicitly loading the default value providers in the Application_Start:
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
ValueProviderFactories.Factories.Add(new RouteDataValueProviderFactory());
ValueProviderFactories.Factories.Add(new FormValueProviderFactory());
ValueProviderFactories.Factories.Add(new HttpFileCollectionValueProviderFactory());
ValueProviderFactories.Factories.Add(new QueryStringValueProviderFactory());
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
BootstrapContainer();
}
I’m using Castle Windsor 3 to manage IoC. Does anyone have any idea why the ControllerBase.ValueProvider would be null?
In the end I gave up and tried a different project (a view engine that renders XAML as PNGs).