U4-5291 - UmbracoVirtualNodeRouteHandler throws exception: parameter culture cannot be null

Created by Asbjørn Riis-Knudsen 29 Jul 2014, 22:24:51 Updated by Shannon Deminick 15 Aug 2014, 18:44:03

I was trying to implement custom routes using the new features described in this blog post: http://shazwazza.com/post/custom-mvc-routes-within-the-umbraco-pipeline/.

This is all working wonderfully - except for the fact that I get an exeption from this line in UmbracoVirtualNodeRouteHandler.cs: var renderModel = new RenderModel(umbracoContext.PublishedContentRequest.PublishedContent, umbracoContext.PublishedContentRequest.Culture);

The exception is about the culture parameter for creating the RenderModel, and when debugging the code, PublishedContentRequest.Culture is indeed null.

I tried changing from line 19 to populate the culture CultureInfo.CurrentCulture, and this allowed it to work, so I believe my code is working. But I may very well have misunderstood something, given the sparse documentation...

@Shandem I have taken the liberty of assigning this to you, since I guess you're the one who wrote this code ;)


Asbjørn Riis-Knudsen 30 Jul 2014, 12:21:26

A simple workaround is to add this code to your UmbracoVirtualNodeRouteHandler: protected override void PreparePublishedContentRequest(Umbraco.Web.Routing.PublishedContentRequest publishedContentRequest) { base.PreparePublishedContentRequest(publishedContentRequest); publishedContentRequest.Culture = CultureInfo.CurrentCulture; }

However, I am not completely sure that the correct culture is applied - but at least it doesn't complain.

Shannon Deminick 15 Aug 2014, 18:43:56

Fixed in 4fe029a695d4bbe295a3c3b4e343df5c19566046

Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.1.5

Due in version: 7.1.5


Story Points: